Пример #1
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Path("appellations")
 public Appellation saveAppellation(Appellation appellation) throws BusinessException {
   if (appellation.getId() == null) {
     return wineServiceFacade.saveAppellation(appellation);
   }
   throw new RuntimeException();
 }
Пример #2
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Path("appellations/{id}")
 public Appellation saveAppellation(@PathParam("id") int id, Appellation appellation)
     throws BusinessException {
   if ((id == appellation.getId()) && (wineServiceFacade.getAppellationById(id) != null)) {
     return wineServiceFacade.saveAppellation(appellation);
   }
   throw new RuntimeException();
 }