package org.silverpeas.mobile.shared.dto.documents;

import static org.fusesource.restygwt.client.AbstractJsonEncoderDecoder.*;

public class PublicationDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.documents.PublicationDTO> {
  
  public static final PublicationDTO_Generated_JsonEncoderDecoder_ INSTANCE = new PublicationDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.documents.PublicationDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodePublicationDTO1750145697(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodePublicationDTO1750145697( org.silverpeas.mobile.shared.dto.documents.PublicationDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("PublicationDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.documents.PublicationDTO parseValue = (org.silverpeas.mobile.shared.dto.documents.PublicationDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getName()), rc, "name");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      isNotNullValuePut(STRING.encode(parseValue.getVersion()), rc, "version");
      isNotNullValuePut(STRING.encode(parseValue.getCreator()), rc, "creator");
      isNotNullValuePut(STRING.encode(parseValue.getCreationDate()), rc, "creationDate");
      isNotNullValuePut(STRING.encode(parseValue.getUpdater()), rc, "updater");
      isNotNullValuePut(STRING.encode(parseValue.getUpdateDate()), rc, "updateDate");
      isNotNullValuePut(INT.encode(parseValue.getCommentsNumber()), rc, "commentsNumber");
      isNotNullValuePut(STRING.encode(parseValue.getInstanceId()), rc, "instanceId");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getContent()), rc, "content");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isDraft()), rc, "draft");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isPublishable()), rc, "publishable");
      isNotNullValuePut(toJSON(parseValue.getLinkedPublications(), org.silverpeas.mobile.shared.dto.documents.PublicationDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "linkedPublications");
      isNotNullValuePut(STRING.encode(parseValue.getVignette()), rc, "vignette");
      isNotNullValuePut(INT.encode(parseValue.getViewsNumber()), rc, "viewsNumber");
      isNotNullValuePut(toJSON(parseValue.getNotAllowedDownloads(), STRING), rc, "notAllowedDownloads");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.documents.PublicationDTO decode(com.google.gwt.json.client.JSONValue value) {
      if( value == null || value.isNull()!=null ) {
        return null;
      }
      com.google.gwt.json.client.JSONObject object = toObject(value);
        return decodePublicationDTO1750145697(object);
      }
      
      private org.silverpeas.mobile.shared.dto.documents.PublicationDTO decodePublicationDTO1750145697(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.documents.PublicationDTO rc = new org.silverpeas.mobile.shared.dto.documents.PublicationDTO();
        rc.setName(getValueToSet(STRING.decode(object.get("name")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        rc.setVersion(getValueToSet(STRING.decode(object.get("version")), null));
        rc.setCreator(getValueToSet(STRING.decode(object.get("creator")), null));
        rc.setCreationDate(getValueToSet(STRING.decode(object.get("creationDate")), null));
        rc.setUpdater(getValueToSet(STRING.decode(object.get("updater")), null));
        rc.setUpdateDate(getValueToSet(STRING.decode(object.get("updateDate")), null));
        rc.setCommentsNumber(getValueToSet(INT.decode(object.get("commentsNumber")), 0));
        rc.setInstanceId(getValueToSet(STRING.decode(object.get("instanceId")), null));
        rc.setContent(getValueToSet(BOOLEAN.decode(object.get("content")), false));
        rc.setDraft(getValueToSet(BOOLEAN.decode(object.get("draft")), false));
        rc.setPublishable(getValueToSet(BOOLEAN.decode(object.get("publishable")), false));
        rc.setLinkedPublications(getValueToSet(toList(object.get("linkedPublications"), org.silverpeas.mobile.shared.dto.documents.PublicationDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setVignette(getValueToSet(STRING.decode(object.get("vignette")), null));
        rc.setViewsNumber(getValueToSet(INT.decode(object.get("viewsNumber")), 0));
        rc.setNotAllowedDownloads(getValueToSet(toList(object.get("notAllowedDownloads"), STRING), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
