@PUT @Path("/note/{noteId}") @Consumes(MediaType.APPLICATION_XML) @Override public Response updateNote(@PathParam("noteId") Integer noteId, Note note) { if (noteId == note.getNoteId()) { cardManager.updateNote(note); } else { return Response.status(Response.Status.BAD_REQUEST).build(); } return Response.ok(note).build(); }
/** {@inheritDoc} */ @POST @Path("/note") @Consumes(MediaType.APPLICATION_XML) @TypeHint(Note.class) @Override public Response addNote(Note note) { IdCardNote newNote; Note savedNote; try { newNote = cardManager.addNote(note); savedNote = Note.createNote(newNote); } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); } return Response.ok().entity(savedNote).build(); }