@RequestMapping(method = RequestMethod.GET) public ModelAndView getGroups() { MainView mv = new MainView(accountManager); mv.addObject("commdevicetypeList", commdevicetypeService.getList()); mv.setViewName("CommDeviceType"); return mv; }
@RequestMapping(method = RequestMethod.GET, params = "new") public ModelAndView insertGroup(CommDeviceType newCommDeviceType) { MainView mv = new MainView(accountManager); mv.addObject("commdevicetypeList", commdevicetypeService.getList()); mv.addObject("commdevicetype", newCommDeviceType); mv.setViewName("CommDeviceType"); return mv; }
@RequestMapping(method = RequestMethod.GET, params = "id") public ModelAndView getGroup(@RequestParam("id") Long id) { MainView mv = new MainView(accountManager); mv.addObject("commdevicetypeList", commdevicetypeService.getList()); mv.addObject("commdevicetype", commdevicetypeService.getCommDeviceTypeByID(id)); mv.setViewName("CommDeviceType"); return mv; }
@RequestMapping(method = RequestMethod.POST, params = "commDeviceType") public ModelAndView updateGroup( @RequestParam("commDeviceType") Long id, @ModelAttribute("commdevicetype") @Valid final CommDeviceType updatableCommDeviceType, final BindingResult result) { MainView mv = new MainView(accountManager); if (result.hasErrors()) { cmsLogger.Log("CommDeviceType valideerimise vead", ""); mv.addObject("commdevicetype", updatableCommDeviceType); mv.addObject("error", "ei valideeru"); } else { mv.addObject("info", "Salvestatud"); mv.addObject( "group", commdevicetypeService.update( updatableCommDeviceType, (long) mv.getModel().get("currentEployeeID"))); } mv.addObject("commdevicetypeList", commdevicetypeService.getList()); mv.setViewName("CommDeviceType"); return mv; }
@RequestMapping( method = RequestMethod.GET, params = {"deleteID"}) public ModelAndView deleteGroup(@RequestParam("deleteID") Long deleteID) { MainView mv = new MainView(accountManager); if (deleteID != null) { String res = commdevicetypeService.remove(deleteID); if (res.isEmpty()) { mv.addObject("info", "Eemladatud"); } else { mv.addObject("error", res); } } else { mv.addObject("error", "Ei leidnud ID"); } mv.addObject("commdevicetypeList", commdevicetypeService.getList()); mv.setViewName("CommDeviceType"); return mv; }