Ejemplo n.º 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);
  }
Ejemplo n.º 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";
  }
Ejemplo n.º 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;
  }