@GET @Path("delete/{databaseName}/{id}") public String deleteHectareById( @PathParam("databaseName") String databaseName, @PathParam("id") int id) { hectareService.delete(databaseName, id); return "success"; }
@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; }
@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; }
@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; }
@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"; }