예제 #1
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Path("formats")
 public Format saveFormat(Format format) throws BusinessException {
   if (format.getId() == null) {
     return wineServiceFacade.saveFormat(format);
   }
   throw new RuntimeException();
 }
예제 #2
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Path("formats/{id}")
 public Format saveFormat(@PathParam("id") int id, Format format) throws BusinessException {
   if ((id == format.getId()) && (wineServiceFacade.getFormatById(id) != null)) {
     return wineServiceFacade.saveFormat(format);
   }
   throw new RuntimeException();
 }