001/* 002 * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * dmetzler 016 */ 017package org.nuxeo.ecm.restapi.jaxrs.io.usermanager; 018 019import java.io.IOException; 020 021import javax.ws.rs.Produces; 022import javax.ws.rs.ext.Provider; 023 024import org.codehaus.jackson.JsonGenerator; 025import org.nuxeo.ecm.automation.jaxrs.io.EntityListWriter; 026import org.nuxeo.ecm.core.api.NuxeoPrincipal; 027 028/** 029 * @since 5.7.3 030 */ 031@Provider 032@Produces({ "application/json+nxentity", "application/json" }) 033public class NuxeoPrincipalListWriter extends EntityListWriter<NuxeoPrincipal> { 034 035 /** 036 * 037 */ 038 public static final String ENTITY_TYPE = "users"; 039 040 @Override 041 protected String getEntityType() { 042 return ENTITY_TYPE; 043 } 044 045 @Override 046 protected void writeItem(JsonGenerator jg, NuxeoPrincipal item) throws IOException { 047 048 NuxeoPrincipalWriter npw = new NuxeoPrincipalWriter(); 049 npw.writeEntity(jg, item); 050 } 051 052}