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;
027import org.nuxeo.ecm.platform.usermanager.io.NuxeoPrincipalListJsonWriter;
028import org.nuxeo.ecm.webengine.jaxrs.coreiodelegate.JsonCoreIODelegate;
029
030/**
031 * @since 5.7.3
032 * @deprecated since 7.10 The Nuxeo JSON marshalling was migrated to nuxeo-core-io. This class is replaced by
033 *             {@link NuxeoPrincipalListJsonWriter} which is registered by default and available to marshal
034 *             {@link NuxeoPrincipal}'s list from the Nuxeo Rest API thanks to the JAX-RS marshaller
035 *             {@link JsonCoreIODelegate}
036 */
037@Deprecated
038@Provider
039@Produces({ "application/json+nxentity", "application/json" })
040public class NuxeoPrincipalListWriter extends EntityListWriter<NuxeoPrincipal> {
041
042    /**
043     *
044     */
045    public static final String ENTITY_TYPE = "users";
046
047    @Override
048    protected String getEntityType() {
049        return ENTITY_TYPE;
050    }
051
052    @Override
053    protected void writeItem(JsonGenerator jg, NuxeoPrincipal item) throws IOException {
054
055        NuxeoPrincipalWriter npw = new NuxeoPrincipalWriter();
056        npw.writeEntity(jg, item);
057    }
058
059}