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

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

public class CalendarEventDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO> {
  
  public static final CalendarEventDTO_Generated_JsonEncoderDecoder_ INSTANCE = new CalendarEventDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeCalendarEventDTO804235588(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeCalendarEventDTO804235588( org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO parseValue = (org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getEventUri()), rc, "eventUri");
      isNotNullValuePut(STRING.encode(parseValue.getCalendarUri()), rc, "calendarUri");
      isNotNullValuePut(STRING.encode(parseValue.getEventPermalinkUrl()), rc, "eventPermalinkUrl");
      isNotNullValuePut(STRING.encode(parseValue.getEventId()), rc, "eventId");
      isNotNullValuePut(STRING.encode(parseValue.getCalendarId()), rc, "calendarId");
      isNotNullValuePut(STRING.encode(parseValue.getCalendarZoneId()), rc, "calendarZoneId");
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      isNotNullValuePut(STRING.encode(parseValue.getContent()), rc, "content");
      isNotNullValuePut(STRING.encode(parseValue.getLocation()), rc, "location");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isOnAllDay()), rc, "onAllDay");
      isNotNullValuePut(STRING.encode(parseValue.getStartDate()), rc, "startDate");
      isNotNullValuePut(STRING.encode(parseValue.getEndDate()), rc, "endDate");
      if(isNotNullAndCheckDefaults(parseValue.getVisibility(), rc, "visibility")) {
        isNotNullValuePut(org.silverpeas.mobile.shared.dto.almanach.VisibilityLevelDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getVisibility()), rc, "visibility");
      }
      if(isNotNullAndCheckDefaults(parseValue.getPriority(), rc, "priority")) {
        isNotNullValuePut(org.silverpeas.mobile.shared.dto.almanach.PriorityDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getPriority()), rc, "priority");
      }
      isNotNullValuePut(org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getRecurrence()), rc, "recurrence");
      isNotNullValuePut(toJSON(parseValue.getAttendees(), org.silverpeas.mobile.shared.dto.almanach.CalendarEventAttendeeDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "attendees");
      isNotNullValuePut(toJSON(parseValue.getAttributes(), org.silverpeas.mobile.shared.dto.almanach.CalendarEventAttributeDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "attributes");
      isNotNullValuePut(STRING.encode(parseValue.getOccurrenceId()), rc, "occurrenceId");
      isNotNullValuePut(toJSON(parseValue.getAttachmentParameters(), org.silverpeas.mobile.shared.dto.almanach.AttachmentParameterDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "attachmentParameters");
      isNotNullValuePut(org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getReminder()), rc, "reminder");
      isNotNullValuePut(STRING.encode(parseValue.getOwnerName()), rc, "ownerName");
      isNotNullValuePut(STRING.encode(parseValue.getCreateDate()), rc, "createDate");
      isNotNullValuePut(STRING.encode(parseValue.getCreatedById()), rc, "createdById");
      isNotNullValuePut(STRING.encode(parseValue.getLastUpdateDate()), rc, "lastUpdateDate");
      isNotNullValuePut(STRING.encode(parseValue.getLastUpdatedById()), rc, "lastUpdatedById");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isCanBeAccessed()), rc, "canBeAccessed");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isCanBeModified()), rc, "canBeModified");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isCanBeDeleted()), rc, "canBeDeleted");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO 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 decodeCalendarEventDTO804235588(object);
      }
      
      private org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO decodeCalendarEventDTO804235588(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO rc = new org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO();
        rc.setEventUri(getValueToSet(STRING.decode(object.get("eventUri")), null));
        rc.setCalendarUri(getValueToSet(STRING.decode(object.get("calendarUri")), null));
        rc.setEventPermalinkUrl(getValueToSet(STRING.decode(object.get("eventPermalinkUrl")), null));
        rc.setEventId(getValueToSet(STRING.decode(object.get("eventId")), null));
        rc.setCalendarId(getValueToSet(STRING.decode(object.get("calendarId")), null));
        rc.setCalendarZoneId(getValueToSet(STRING.decode(object.get("calendarZoneId")), null));
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        rc.setContent(getValueToSet(STRING.decode(object.get("content")), null));
        rc.setLocation(getValueToSet(STRING.decode(object.get("location")), null));
        rc.setOnAllDay(getValueToSet(BOOLEAN.decode(object.get("onAllDay")), false));
        rc.setStartDate(getValueToSet(STRING.decode(object.get("startDate")), null));
        rc.setEndDate(getValueToSet(STRING.decode(object.get("endDate")), null));
        rc.setVisibility(getValueToSet(org.silverpeas.mobile.shared.dto.almanach.VisibilityLevelDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("visibility")), null));
        rc.setPriority(getValueToSet(org.silverpeas.mobile.shared.dto.almanach.PriorityDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("priority")), null));
        rc.setRecurrence(getValueToSet(org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("recurrence")), null));
        rc.setAttendees(getValueToSet(toList(object.get("attendees"), org.silverpeas.mobile.shared.dto.almanach.CalendarEventAttendeeDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setAttributes(getValueToSet(toList(object.get("attributes"), org.silverpeas.mobile.shared.dto.almanach.CalendarEventAttributeDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setOccurrenceId(getValueToSet(STRING.decode(object.get("occurrenceId")), null));
        rc.setAttachmentParameters(getValueToSet(toList(object.get("attachmentParameters"), org.silverpeas.mobile.shared.dto.almanach.AttachmentParameterDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setReminder(getValueToSet(org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("reminder")), null));
        rc.setOwnerName(getValueToSet(STRING.decode(object.get("ownerName")), null));
        rc.setCreateDate(getValueToSet(STRING.decode(object.get("createDate")), null));
        rc.setCreatedById(getValueToSet(STRING.decode(object.get("createdById")), null));
        rc.setLastUpdateDate(getValueToSet(STRING.decode(object.get("lastUpdateDate")), null));
        rc.setLastUpdatedById(getValueToSet(STRING.decode(object.get("lastUpdatedById")), null));
        rc.setCanBeAccessed(getValueToSet(BOOLEAN.decode(object.get("canBeAccessed")), false));
        rc.setCanBeModified(getValueToSet(BOOLEAN.decode(object.get("canBeModified")), false));
        rc.setCanBeDeleted(getValueToSet(BOOLEAN.decode(object.get("canBeDeleted")), false));
        return rc;
      }
      
    }
