Пример #1
0
 @RequestMapping(value = "/links/addchild/{parentLinkName}", method = GET)
 public String addParent(
     Model model, @PathVariable(value = "parentLinkName") String parentLinkName) {
   Link link = new Link();
   link.setParentLinkName(parentLinkName);
   model.addAttribute("link", link);
   return "datastore/link";
 }
Пример #2
0
 @RequestMapping(value = "/links/addunder/{categoryName}", method = GET)
 public String addCategory(
     Model model, @PathVariable(value = "categoryName") String categoryName) {
   Link link = new Link();
   link.setCategoryName(categoryName);
   model.addAttribute("link", link);
   return "datastore/link";
 }
Пример #3
0
 @RequestMapping(value = "/api/links", method = POST)
 @ResponseBody
 public Link create(@RequestBody Link link) {
   LOGGER.info("Creating new links {}", link);
   if (link.getParentLinkName() != null && link.getParentLinkName().trim().length() != 0) {
     Link parentLink = linkManager.getLink(link.getParentLinkName());
     link.setCategoryName(parentLink.getCategoryName());
   }
   return linkManager.add(link);
 }
Пример #4
0
 @RequestMapping(value = "/api/links/{name}", method = PUT)
 @ResponseStatus(value = HttpStatus.NO_CONTENT)
 public void update(@PathVariable(value = "name") String name, @RequestBody Link links) {
   LOGGER.info("Updating link with id {} with {}", name, links);
   if (name.equals(links.getName())) {
     linkManager.update(links);
   }
 }