@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public Tag updateTag(@RequestBody Tag updatedTag, @PathVariable Long id) { Tag tag = tagDao.getTagById(id); tag.setName(updatedTag.getName()); tag.setItemCount(tag.getItemCount() + 1); return tagDao.modifyTag(tag); }
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) public void deleteTag(@PathVariable Long id) { tagDao.deleteTag(id); }
@RequestMapping(method = RequestMethod.GET) public List<Tag> findTag() { return tagDao.findAll(); }
@RequestMapping(method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.CREATED) public Tag addTag(@RequestBody Tag tag) { tag.setId(null); return tagDao.newTag(tag); }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) public Tag getTag(@PathVariable Long id) { return tagDao.getTagById(id); }