@PUT @Path("/{noteid}") public void updateNote(@PathParam("noteid") int noteID, NoteEntity newNote) { UserEntity user = new UserEntity(); user.setEmail(email); newNote.setUser(user); notesService.verifyAndUpdateNote(email, noteID, newNote); }
@GET public List<Note> getAllNotesByUser() { List<NoteEntity> noteEntityList = notesService.getAllNotesByUser(email); List<Note> noteList = new ArrayList<Note>(); for (NoteEntity notes : noteEntityList) { Note note = new Note(notes); note.getLinks().add(new LinkReference("self", "/users/" + email + "/" + note.getNoteId())); note.getLinks().add(new LinkReference("owner", "/users/" + email)); noteList.add(note); } return noteList; }
@DELETE @Path("/{noteid}") public void deleteNote(@PathParam("noteid") int noteID) { notesService.verifyAndRemoveNote(email, noteID); }
@DELETE public void removeAllNotes() { notesService.removeAllNotes(email); }
@POST public void addNote(NoteEntity notes) { notesService.addNoteForUser(email, notes); }