@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("countries/{id}") public Country saveCountry(@PathParam("id") int id, Country country) throws BusinessException { if ((id == country.getId()) && (wineServiceFacade.getCountryById(id) != null)) { return wineServiceFacade.saveCountry(country); } throw new RuntimeException(); }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("countries") public Country saveCountry(Country country) throws BusinessException { if (country.getId() == null) { return wineServiceFacade.saveCountry(country); } throw new RuntimeException(); }