コード例 #1
0
 @RequestMapping(method = RequestMethod.PUT)
 public String update(
     @Valid CompositeServerSimulation compositeSimulation,
     BindingResult result,
     Model model,
     HttpServletRequest request) {
   if (result.hasErrors()) {
     model.addAttribute("compositeSimulation", compositeSimulation);
     addDateTimeFormatPatterns(model);
     return "compositesimulations/update";
   }
   compositeSimulation.merge();
   return "redirect:/compositesimulations/"
       + encodeUrlPathSegment(compositeSimulation.getId().toString(), request);
 }
コード例 #2
0
 @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
 public String updateForm(@PathVariable("id") Long id, Model model) {
   model.addAttribute(
       "compositeSimulation", CompositeServerSimulation.findCompositeSimulation(id));
   addDateTimeFormatPatterns(model);
   return "compositesimulations/update";
 }
コード例 #3
0
 @RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = "accept=text/html")
 public String show(@PathVariable("id") Long id, Model model) {
   addDateTimeFormatPatterns(model);
   model.addAttribute(
       "compositesimulation", CompositeServerSimulation.findCompositeSimulation(id));
   model.addAttribute("itemId", id);
   return "compositesimulations/show";
 }
コード例 #4
0
 @RequestMapping(method = RequestMethod.GET)
 public String list(
     @RequestParam(value = "page", required = false) Integer page,
     @RequestParam(value = "size", required = false) Integer size,
     Model model) {
   if (page != null || size != null) {
     int sizeNo = size == null ? 10 : size.intValue();
     model.addAttribute(
         "compositesimulations",
         CompositeServerSimulation.findCompositeSimulationEntries(
             page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
     float nrOfPages = (float) CompositeServerSimulation.countCompositeSimulations() / sizeNo;
     model.addAttribute(
         "maxPages",
         (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
   } else {
     model.addAttribute(
         "compositesimulations", CompositeServerSimulation.findAllCompositeSimulations());
   }
   addDateTimeFormatPatterns(model);
   return "compositesimulations/list";
 }
コード例 #5
0
 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
 public String delete(
     @PathVariable("id") Long id,
     @RequestParam(value = "page", required = false) Integer page,
     @RequestParam(value = "size", required = false) Integer size,
     Model model) {
   CompositeServerSimulation.findCompositeSimulation(id).remove();
   model.addAttribute("page", (page == null) ? "1" : page.toString());
   model.addAttribute("size", (size == null) ? "10" : size.toString());
   return "redirect:/compositesimulations?page="
       + ((page == null) ? "1" : page.toString())
       + "&size="
       + ((size == null) ? "10" : size.toString());
 }
コード例 #6
0
 @RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = "accept=application/xml")
 @ResponseBody
 public CompositeServerSimulation showXml(@PathVariable("id") Long id, Model model) {
   return CompositeServerSimulation.findCompositeSimulation(id);
 }