001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others.
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 *     Thomas Roger
016 */
017
018package org.nuxeo.ecm.restapi.jaxrs.io.conversion;
019
020import java.io.IOException;
021
022import javax.ws.rs.Produces;
023import javax.ws.rs.core.MediaType;
024import javax.ws.rs.ext.Provider;
025
026import org.codehaus.jackson.JsonGenerator;
027import org.nuxeo.ecm.automation.jaxrs.io.EntityWriter;
028
029/**
030 * @since 7.4
031 */
032@Provider
033@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON + "+nxentity" })
034public class ConversionScheduledWriter extends EntityWriter<ConversionScheduled> {
035
036    public static final String ENTITY_TYPE = "conversionScheduled";
037
038    @Override
039    protected void writeEntityBody(JsonGenerator jg, ConversionScheduled conversionScheduled) throws IOException {
040        jg.writeStringField("conversionId", conversionScheduled.id);
041        jg.writeStringField("pollingURL", conversionScheduled.pollingURL);
042    }
043
044    @Override
045    protected String getEntityType() {
046        return ENTITY_TYPE;
047    }
048}