@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(); }
@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(); }