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.automation.jaxrs.io.documents;
018
019import java.io.IOException;
020
021import org.codehaus.jackson.JsonGenerator;
022import org.nuxeo.ecm.automation.core.operations.business.adapter.BusinessAdapter;
023import org.nuxeo.ecm.automation.io.services.codec.ObjectCodecService;
024import org.nuxeo.ecm.automation.jaxrs.io.EntityListWriter;
025import org.nuxeo.runtime.api.Framework;
026
027/**
028 * @since 5.8
029 */
030public class BusinessAdapterListWriter extends EntityListWriter<BusinessAdapter> {
031
032    @Override
033    protected String getEntityType() {
034        return "adapters";
035    }
036
037    @Override
038    protected void writeItem(JsonGenerator jg, BusinessAdapter item) throws IOException {
039        ObjectCodecService service = Framework.getLocalService(ObjectCodecService.class);
040        service.write(jg, item);
041    }
042
043}