Example #1
0
 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
 public String delete(
     @PathVariable("id") Integer id,
     @RequestParam(value = "page", required = false) Integer page,
     @RequestParam(value = "size", required = false) Integer size,
     Model uiModel) {
   Oldgroup oldgroup = Oldgroup.findOldgroup(id);
   oldgroup.remove();
   uiModel.asMap().clear();
   uiModel.addAttribute("page", (page == null) ? "1" : page.toString());
   uiModel.addAttribute("size", (size == null) ? "10" : size.toString());
   return "redirect:/oldgroups";
 }
Example #2
0
 @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
 public String update(
     @Valid Oldgroup oldgroup,
     BindingResult bindingResult,
     Model uiModel,
     HttpServletRequest httpServletRequest) {
   if (bindingResult.hasErrors()) {
     populateEditForm(uiModel, oldgroup);
     return "oldgroups/update";
   }
   uiModel.asMap().clear();
   oldgroup.merge();
   return "redirect:/oldgroups/"
       + encodeUrlPathSegment(oldgroup.getId().toString(), httpServletRequest);
 }
Example #3
0
 @RequestMapping(produces = "text/html")
 public String list(
     @RequestParam(value = "page", required = false) Integer page,
     @RequestParam(value = "size", required = false) Integer size,
     Model uiModel) {
   if (page != null || size != null) {
     int sizeNo = size == null ? 10 : size.intValue();
     final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo;
     uiModel.addAttribute("oldgroups", Oldgroup.findOldgroupEntries(firstResult, sizeNo));
     float nrOfPages = (float) Oldgroup.countOldgroups() / sizeNo;
     uiModel.addAttribute(
         "maxPages",
         (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
   } else {
     uiModel.addAttribute("oldgroups", Oldgroup.findAllOldgroups());
   }
   return "oldgroups/list";
 }
Example #4
0
 @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
 public String updateForm(@PathVariable("id") Integer id, Model uiModel) {
   populateEditForm(uiModel, Oldgroup.findOldgroup(id));
   return "oldgroups/update";
 }
Example #5
0
 @RequestMapping(value = "/{id}", produces = "text/html")
 public String show(@PathVariable("id") Integer id, Model uiModel) {
   uiModel.addAttribute("oldgroup", Oldgroup.findOldgroup(id));
   uiModel.addAttribute("itemId", id);
   return "oldgroups/show";
 }