Example #1
0
  @GET
  @Path("delete/{databaseName}/{id}")
  public String deleteHectareById(
      @PathParam("databaseName") String databaseName, @PathParam("id") int id) {

    hectareService.delete(databaseName, id);
    return "success";
  }
Example #2
0
  @POST
  @Path("upsert/{databaseName}")
  public String upsertHectare(
      @PathParam("databaseName") String databaseName, WebServiceHectare webServiceHectare) {

    WSHectare hectareComeFromService = new WSHectare();
    hectareComeFromService =
        (WSHectare) ObjectConverter.convertWebObjectToNormalObject(webServiceHectare);

    String result = hectareService.upsert(databaseName, hectareComeFromService);

    return result;
  }
Example #3
0
  @GET
  @Path("/getHectareById/{databaseName}/{id}")
  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
  public WSHectare getHectare(
      @PathParam("databaseName") String databaseName, @PathParam("id") int id) {

    try {

      return hectareService.getHectareById(databaseName, "hectare", id);

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return hectare;
  }
Example #4
0
  @GET
  @Path("/getHectares/{database}")
  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
  public WSHectare[] getAllHectares(@PathParam("database") String databaseName) {

    try {

      List<WSHectare> hectareList = hectareService.getAllHectares(databaseName);
      WSHectare[] hckr = new WSHectare[hectareList.size()];
      return hectareList.toArray(hckr);

    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return null;
  }
Example #5
0
  @GET
  @Path("upsert/{databaseName}/{id}/{nodeId}/{parcelId}/{status}/{transactionTime}")
  public String upsertHectare(
      @PathParam("databaseName") String databaseName,
      @PathParam("id") int id,
      @PathParam("nodeId") int nodeId,
      @PathParam("parcelId") int parcelId,
      @PathParam("status") int status,
      @PathParam("transactionTime") String transactionTime)
      throws ParseException {

    WSHectare hectareFromService = new WSHectare();
    hectareFromService.setId(id);
    hectareFromService.setNodeId(nodeId);
    hectareFromService.setParcelId(parcelId);
    hectareFromService.setStatus(status);
    hectareFromService.setTransactionTime(DateConverter.stringToDate(transactionTime));

    hectareService.upsert(databaseName, hectareFromService);

    return "success";
  }