コード例 #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();
 }