예제 #1
0
  public WCHectare getHectareById(int id) {

    resource =
        client.resource(
            WebServicePaths.getHectareById + UserConstants.getSessionUser().getFarm() + id);
    WebServiceHectare webServiceHectare = resource.get(WebServiceHectare.class);

    return (WCHectare) ObjectConverter.convertWebObjectToNormalObject(webServiceHectare);
  }
예제 #2
0
  public String upsertTheRemoteDB(WCHectare hectare) {

    WebServiceHectare webServiceHectare =
        (WebServiceHectare) ObjectConverter.convertNormalObjectToWebObject(hectare);
    resource =
        client.resource(WebServicePaths.upsertHectare + UserConstants.getSessionUser().getFarm());
    clientResponse =
        resource.type(MediaType.APPLICATION_XML).post(ClientResponse.class, webServiceHectare);

    return "success";
  }
예제 #3
0
  public List<WCHectare> getAllHectares() {

    List<WCHectare> hectares = new ArrayList<WCHectare>();

    resource =
        client.resource(WebServicePaths.getHectares + UserConstants.getSessionUser().getFarm());
    WebServiceHectare[] hectareArray = resource.get(WebServiceHectare[].class);

    List<WebServiceHectare> hectareList = Arrays.asList(hectareArray);

    WCHectare hectare = new WCHectare();
    for (WebServiceHectare webServiceHectare : hectareList) {

      hectare = (WCHectare) ObjectConverter.convertWebObjectToNormalObject(webServiceHectare);
      hectares.add(hectare);
    }

    return hectares;
  }