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

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

public class ServiceWorkflow_Generated_RestServiceProxy_ implements org.silverpeas.mobile.shared.services.rest.ServiceWorkflow, 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("/mobile/workflow");
    }
    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 getActionForm(java.lang.String appId, java.lang.String instanceId, java.lang.String role, java.lang.String action, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.workflow.WorkflowFormActionDTO> callback) {
    final java.lang.String final_appId = appId;
    final java.lang.String final_instanceId = instanceId;
    final java.lang.String final_role = role;
    final java.lang.String final_action = action;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve(""+(appId== null? null : com.google.gwt.http.client.URL.encodePathSegment(appId))+"/actionForm/"+(instanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(instanceId))+"/"+(role== null? null : com.google.gwt.http.client.URL.encodePathSegment(role))+"/"+(action== null? null : com.google.gwt.http.client.URL.encodePathSegment(action))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, "application/json");
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<org.silverpeas.mobile.shared.dto.workflow.WorkflowFormActionDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.workflow.WorkflowFormActionDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.workflow.WorkflowFormActionDTO_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 getDataInstances(java.lang.String appId, java.lang.String userRole, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO> callback) {
    final java.lang.String final_appId = appId;
    final java.lang.String final_userRole = userRole;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve(""+(appId== null? null : com.google.gwt.http.client.URL.encodePathSegment(appId))+"/datainstances/"+(userRole== null? null : com.google.gwt.http.client.URL.encodePathSegment(userRole))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, "application/json");
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO_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 getPresentationForm(java.lang.String appId, java.lang.String instanceId, java.lang.String role, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.workflow.WorkflowInstancePresentationFormDTO> callback) {
    final java.lang.String final_appId = appId;
    final java.lang.String final_instanceId = instanceId;
    final java.lang.String final_role = role;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve(""+(appId== null? null : com.google.gwt.http.client.URL.encodePathSegment(appId))+"/presentationForm/"+(instanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(instanceId))+"/"+(role== null? null : com.google.gwt.http.client.URL.encodePathSegment(role))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, "application/json");
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<org.silverpeas.mobile.shared.dto.workflow.WorkflowInstancePresentationFormDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.workflow.WorkflowInstancePresentationFormDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.workflow.WorkflowInstancePresentationFormDTO_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 getUserField(java.lang.String appId, java.lang.String instanceId, java.lang.String actionName, java.lang.String fieldName, java.lang.String role, org.fusesource.restygwt.client.MethodCallback<java.util.List<org.silverpeas.mobile.shared.dto.BaseDTO>> callback) {
    final java.lang.String final_appId = appId;
    final java.lang.String final_instanceId = instanceId;
    final java.lang.String final_actionName = actionName;
    final java.lang.String final_fieldName = fieldName;
    final java.lang.String final_role = role;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve(""+(appId== null? null : com.google.gwt.http.client.URL.encodePathSegment(appId))+"/userField/"+(instanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(instanceId))+"/"+(actionName== null? null : com.google.gwt.http.client.URL.encodePathSegment(actionName))+"/"+(fieldName== null? null : com.google.gwt.http.client.URL.encodePathSegment(fieldName))+"/"+(role== null? null : com.google.gwt.http.client.URL.encodePathSegment(role))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, "application/json");
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<java.util.List<org.silverpeas.mobile.shared.dto.BaseDTO>>(__method, callback) {
        protected java.util.List<org.silverpeas.mobile.shared.dto.BaseDTO> parseResult() throws Exception {
          try {
            return toList(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()), org.silverpeas.mobile.shared.dto.BaseDTO_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 getWorkflowInstances(java.lang.String appId, java.lang.String userRole, int callNumber, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.StreamingList<org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO>> callback) {
    final java.lang.String final_appId = appId;
    final java.lang.String final_userRole = userRole;
    final int final_callNumber = callNumber;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve(""+(appId== null? null : com.google.gwt.http.client.URL.encodePathSegment(appId))+"/instances/"+(userRole== null? null : com.google.gwt.http.client.URL.encodePathSegment(userRole))+"/"+(""+callNumber== null? null : com.google.gwt.http.client.URL.encodePathSegment(""+callNumber))+"")
    .get();
    __method.setDispatcher(this.dispatcher);
    __method.header(org.fusesource.restygwt.client.Resource.HEADER_ACCEPT, "application/json");
    try {
      __method.send(new org.fusesource.restygwt.client.AbstractRequestCallback<org.silverpeas.mobile.shared.StreamingList<org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO>>(__method, callback) {
        protected org.silverpeas.mobile.shared.StreamingList<org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO> parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.StreamingList__org_silverpeas_mobile_shared_dto_workflow_WorkflowInstanceDTO_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);
    }
  }
}
