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

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

public class ServiceNavigation_Generated_RestServiceProxy_ implements org.silverpeas.mobile.shared.services.rest.ServiceNavigation, 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/navigation");
    }
    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 clearAppCache(org.fusesource.restygwt.client.MethodCallback<java.lang.Void> callback) {
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("clearAppCache")
    .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.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 getApp(java.lang.String instanceId, java.lang.String contentId, java.lang.String contentType, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO> callback) {
    final java.lang.String final_instanceId = instanceId;
    final java.lang.String final_contentId = contentId;
    final java.lang.String final_contentType = contentType;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("app/"+(instanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(instanceId))+"/"+(contentId== null? null : com.google.gwt.http.client.URL.encodePathSegment(contentId))+"/"+(contentType== null? null : com.google.gwt.http.client.URL.encodePathSegment(contentType))+"/")
    .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.navigation.ApplicationInstanceDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO_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 getHomePageData(java.lang.String spaceId, java.lang.String zoom, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.HomePageDTO> callback) {
    final java.lang.String final_spaceId = spaceId;
    final java.lang.String final_zoom = zoom;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("homepage/"+(spaceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(spaceId))+"/"+(zoom== null? null : com.google.gwt.http.client.URL.encodePathSegment(zoom))+"/")
    .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.HomePageDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.HomePageDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.HomePageDTO_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 getPersonnalSpaceContent(java.lang.String userId, org.fusesource.restygwt.client.MethodCallback<java.util.List<org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO>> callback) {
    final java.lang.String final_userId = userId;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("personalSpace/"+(userId== null? null : com.google.gwt.http.client.URL.encodePathSegment(userId))+"/")
    .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.navigation.ApplicationInstanceDTO>>(__method, callback) {
        protected java.util.List<org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO> parseResult() throws Exception {
          try {
            return toList(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()), org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO_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 getSpace(java.lang.String spaceId, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.navigation.SpaceDTO> callback) {
    final java.lang.String final_spaceId = spaceId;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("space/"+(spaceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(spaceId))+"/")
    .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.navigation.SpaceDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.navigation.SpaceDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.navigation.SpaceDTO_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 getSpacesAndApps(java.lang.String rootSpaceId, org.fusesource.restygwt.client.MethodCallback<java.util.List<org.silverpeas.mobile.shared.dto.navigation.SilverpeasObjectDTO>> callback) {
    final java.lang.String final_rootSpaceId = rootSpaceId;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("spacesAndApps/"+(rootSpaceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(rootSpaceId))+"/")
    .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.navigation.SilverpeasObjectDTO>>(__method, callback) {
        protected java.util.List<org.silverpeas.mobile.shared.dto.navigation.SilverpeasObjectDTO> parseResult() throws Exception {
          try {
            return toList(com.google.gwt.json.client.JSONParser.parse(__method.getResponse().getText()), org.silverpeas.mobile.shared.dto.navigation.SilverpeasObjectDTO_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 getUser(java.lang.String login, java.lang.String domainId, org.fusesource.restygwt.client.MethodCallback<org.silverpeas.mobile.shared.dto.DetailUserDTO> callback) {
    final java.lang.String final_login = login;
    final java.lang.String final_domainId = domainId;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("user/"+(login== null? null : com.google.gwt.http.client.URL.encodePathSegment(login))+"/"+(domainId== null? null : com.google.gwt.http.client.URL.encodePathSegment(domainId))+"/")
    .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.DetailUserDTO>(__method, callback) {
        protected org.silverpeas.mobile.shared.dto.DetailUserDTO parseResult() throws Exception {
          try {
            return org.silverpeas.mobile.shared.dto.DetailUserDTO_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 isWorkflowApp(java.lang.String intanceId, org.fusesource.restygwt.client.MethodCallback<java.lang.Boolean> callback) {
    final java.lang.String final_intanceId = intanceId;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("isWorkflowApp/"+(intanceId== null? null : com.google.gwt.http.client.URL.encodePathSegment(intanceId))+"/")
    .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.lang.Boolean>(__method, callback) {
        protected java.lang.Boolean parseResult() throws Exception {
          try {
            return BOOLEAN.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 setTabletMode(org.fusesource.restygwt.client.MethodCallback<java.lang.Boolean> callback) {
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("setTabletMode")
    .post();
    __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.lang.Boolean>(__method, callback) {
        protected java.lang.Boolean parseResult() throws Exception {
          try {
            return BOOLEAN.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 storeTokenMessaging(java.lang.String token, org.fusesource.restygwt.client.MethodCallback<java.lang.Void> callback) {
    final java.lang.String final_token = token;
    final org.fusesource.restygwt.client.Method __method =
    getResource()
    .resolve("storeTokenMessaging/"+(token== null? null : com.google.gwt.http.client.URL.encodePathSegment(token))+"/")
    .put();
    __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);
    }
  }
}
