Пример #1
0
 @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);
 }
Пример #2
0
 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
 @ResponseStatus(value = HttpStatus.NO_CONTENT)
 public void deleteTag(@PathVariable Long id) {
   tagDao.deleteTag(id);
 }
Пример #3
0
 @RequestMapping(method = RequestMethod.GET)
 public List<Tag> findTag() {
   return tagDao.findAll();
 }
Пример #4
0
 @RequestMapping(method = RequestMethod.POST)
 @ResponseStatus(value = HttpStatus.CREATED)
 public Tag addTag(@RequestBody Tag tag) {
   tag.setId(null);
   return tagDao.newTag(tag);
 }
Пример #5
0
 @RequestMapping(value = "/{id}", method = RequestMethod.GET)
 public Tag getTag(@PathVariable Long id) {
   return tagDao.getTagById(id);
 }