Ejemplo n.º 1
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Path("regions")
 public Region saveRegion(Region region) throws BusinessException {
   if (region.getId() == null) {
     return wineServiceFacade.saveRegion(region);
   }
   throw new RuntimeException();
 }
Ejemplo n.º 2
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Path("regions/{id}")
 public Region saveRegion(@PathParam("id") int id, Region region) throws BusinessException {
   if ((id == region.getId()) && (wineServiceFacade.getRegionById(id) != null)) {
     return wineServiceFacade.saveRegion(region);
   }
   throw new RuntimeException();
 }