@DELETE @Path("/{id}") public Response deletarAnimal(@PathParam("id") int id) { Animal animal = AnimalDao.getById(id); try { AdocaoDao.deletePorAnimal(animal); AnuncioDao.deletePorAnimal(animal); AnimalDao.deleteAnimal(animal); } catch (Exception e) { String result = "Error: " + e.getMessage(); return Response.status(500).entity(result).build(); } String result = "Animal Deletado : " + animal.getNomeAdotivo(); return Response.status(200).entity(result).build(); }
@GET @Path("/{id}") @Produces("application/json") public Animal trazerAnimal(@PathParam("id") int id) { return AnimalDao.getById(id); }