package org.silverpeas.mobile.shared.services.rest;

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

public class ServiceReminder_Generated_RestServiceProxy_ implements org.silverpeas.mobile.shared.services.rest.ServiceReminder, org.fusesource.restygwt.client.RestServiceProxy {
  private org.fusesource.restygwt.client.Resource resource = null;
  
  public void setResource(org.fusesource.restygwt.client.Resource resource) {
    this.resource = resource;
  }
  public org.fusesource.restygwt.client.Resource getResource() {
    if (this.resource == null) {
      String serviceRoot = org.fusesource.restygwt.client.Defaults.getServiceRoot();
      this.resource = new org.fusesource.restygwt.client.Resource(serviceRoot).resolve("/reminder");
    }
    return this.resource;
  }
  private org.fusesource.restygwt.client.Dispatcher dispatcher = null;
  
  public void setDispatcher(org.fusesource.restygwt.client.Dispatcher dispatcher) {
    this.dispatcher = dispatcher;
  }
  
  public org.fusesource.restygwt.client.Dispatcher getDispatcher() {
    return this.dispatcher;
  }
  public void createReminder(java.lang.String componentInstanceId, java.lang.String type, java.lang.String localId, org.silverpeas.mobile.shared.dto.reminder.ReminderDTO dto, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO> callback) {
    final java.lang.String final_componentInstanceId = componentInstanceId;
    final java.lang.String final_type = type;
    final java.lang.String final_localId = localId;
    final org.silverpeas.mobile.shared.dto.reminder.ReminderDTO final_dto = dto;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("/"+(componentInstanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(componentInstanceId))+"/"+(type== null? null : com.google.gwt.http.client.URL.encodePathSegment(type))+"/"+(localId== null? null : com.google.gwt.http.client.URL.encodePathSegment(localId))+"")
    .post();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, org.fusesource.restygwt.client.Resource.CONTENT_TYPE_JSON);
    __method.json(org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(dto));
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.reminder.ReminderDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()));
          } catch (Throwable __e) {
            throw new org.fusesource.restygwt.client.ResponseFormatException("Response was NOT a valid JSON document", __e);
          }
        }
      });
    } catch (com.google.gwt.http.client.RequestException __e) {
      callback.onFailure(__method,__e);
    }
  }
  public void deleteReminder(java.lang.String componentInstanceId, java.lang.String type, java.lang.String localId, java.lang.String id, org.fusesource.restygwt.client.MethodCallback<java.lang.Void> callback) {
    final java.lang.String final_componentInstanceId = componentInstanceId;
    final java.lang.String final_type = type;
    final java.lang.String final_localId = localId;
    final java.lang.String final_id = id;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("/"+(componentInstanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(componentInstanceId))+"/"+(type== null? null : com.google.gwt.http.client.URL.encodePathSegment(type))+"/"+(localId== null? null : com.google.gwt.http.client.URL.encodePathSegment(localId))+"/"+(id== null? null : com.google.gwt.http.client.URL.encodePathSegment(id))+"")
    .delete();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, org.fusesource.restygwt.client.Resource.CONTENT_TYPE_JSON);
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<java.lang.Void>(__method, callback) {
        protected java.lang.Void parseResult() throws Exception {
          return (java.lang.Void) null;
        }
      });
    } catch (com.google.gwt.http.client.RequestException __e) {
      callback.onFailure(__method,__e);
    }
  }
  public void getPossibleDurations(java.lang.String componentInstanceId, java.lang.String type, java.lang.String localId, java.lang.String property, org.fusesource.restygwt.client.MethodCallback<java.util.List<java.lang.String>> callback) {
    final java.lang.String final_componentInstanceId = componentInstanceId;
    final java.lang.String final_type = type;
    final java.lang.String final_localId = localId;
    final java.lang.String final_property = property;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("/"+(componentInstanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(componentInstanceId))+"/"+(type== null? null : com.google.gwt.http.client.URL.encodePathSegment(type))+"/"+(localId== null? null : com.google.gwt.http.client.URL.encodePathSegment(localId))+"/possibledurations/"+(property== null? null : com.google.gwt.http.client.URL.encodePathSegment(property))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, org.fusesource.restygwt.client.Resource.CONTENT_TYPE_JSON);
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<java.util.List<java.lang.String>>(__method, callback) {
        protected java.util.List<java.lang.String> parseResult() throws Exception {
          try {
            return toList(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()), STRING);
          } catch (Throwable __e) {
            throw new org.fusesource.restygwt.client.ResponseFormatException("Response was NOT a valid JSON document", __e);
          }
        }
      });
    } catch (com.google.gwt.http.client.RequestException __e) {
      callback.onFailure(__method,__e);
    }
  }
  public void getReminders(java.lang.String componentInstanceId, java.lang.String type, java.lang.String localId, org.fusesource.restygwt.client.MethodCallback<java.util.List<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO>> callback) {
    final java.lang.String final_componentInstanceId = componentInstanceId;
    final java.lang.String final_type = type;
    final java.lang.String final_localId = localId;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("/"+(componentInstanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(componentInstanceId))+"/"+(type== null? null : com.google.gwt.http.client.URL.encodePathSegment(type))+"/"+(localId== null? null : com.google.gwt.http.client.URL.encodePathSegment(localId))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, org.fusesource.restygwt.client.Resource.CONTENT_TYPE_JSON);
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<java.util.List<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO>>(__method, callback) {
        protected java.util.List<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO> parseResult() throws Exception {
          try {
            return toList(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()), org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE);
          } catch (Throwable __e) {
            throw new org.fusesource.restygwt.client.ResponseFormatException("Response was NOT a valid JSON document", __e);
          }
        }
      });
    } catch (com.google.gwt.http.client.RequestException __e) {
      callback.onFailure(__method,__e);
    }
  }
  public void updateReminder(java.lang.String componentInstanceId, java.lang.String type, java.lang.String localId, java.lang.String id, org.silverpeas.mobile.shared.dto.reminder.ReminderDTO dto, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO> callback) {
    final java.lang.String final_componentInstanceId = componentInstanceId;
    final java.lang.String final_type = type;
    final java.lang.String final_localId = localId;
    final java.lang.String final_id = id;
    final org.silverpeas.mobile.shared.dto.reminder.ReminderDTO final_dto = dto;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("/"+(componentInstanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(componentInstanceId))+"/"+(type== null? null : com.google.gwt.http.client.URL.encodePathSegment(type))+"/"+(localId== null? null : com.google.gwt.http.client.URL.encodePathSegment(localId))+"/"+(id== null? null : com.google.gwt.http.client.URL.encodePathSegment(id))+"")
    .put();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, org.fusesource.restygwt.client.Resource.CONTENT_TYPE_JSON);
    __method.json(org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(dto));
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.reminder.ReminderDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.reminder.ReminderDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()));
          } catch (Throwable __e) {
            throw new org.fusesource.restygwt.client.ResponseFormatException("Response was NOT a valid JSON document", __e);
          }
        }
      });
    } catch (com.google.gwt.http.client.RequestException __e) {
      callback.onFailure(__method,__e);
    }
  }
}
