コード例 #1
0
 @PreAuthorize("hasAuthority('ADMIN')")
 @RequestMapping(value = "/admin/marca/remove", method = RequestMethod.GET)
 public String marcaRemove(@RequestParam(value = "id", required = true) long id, Model model) {
   System.out.println("Marca -> Remove -> GET");
   mar.delete(id);
   return "redirect:/admin/marche";
 }
コード例 #2
0
 @PreAuthorize("hasAuthority('ADMIN')")
 @RequestMapping(value = "/admin/marca", method = RequestMethod.GET)
 public String marca(@RequestParam(value = "id", required = true) long id, Model model) {
   System.out.println("Marca -> GET");
   Marca marca = mar.findOne(id);
   model.addAttribute("marca", marca);
   return "admin@marcaEditForm";
 }
コード例 #3
0
 @PreAuthorize("hasAuthority('ADMIN')")
 @RequestMapping(
     value = "/json/marche/search",
     method = RequestMethod.GET,
     produces = "application/json")
 public @ResponseBody Marche marcaJSON(
     @RequestParam(value = "q", required = true) String q, Model model) {
   return new Marche(mar.findByDescrizioneContainingIgnoreCase(q));
 }
コード例 #4
0
 @PreAuthorize("hasAuthority('ADMIN')")
 @RequestMapping(value = "/admin/marca/new", method = RequestMethod.POST)
 public String marcaPOST(@ModelAttribute Marca marca, Model model) {
   System.out.println("Marca -> Nuovo -> POST");
   try {
     mar.save(marca);
     return "redirect:/admin/marche";
   } catch (Exception e) {
     model.addAttribute("messaggio", "La marca " + marca.getDescrizione() + " é già presente");
     return "admin@marcaNewForm";
   }
 }
コード例 #5
0
 @PreAuthorize("hasAuthority('ADMIN')")
 @RequestMapping(value = "/json/marche", method = RequestMethod.GET)
 public @ResponseBody Marche marcheJSON(Model model) {
   return new Marche(mar.findAll());
 }
コード例 #6
0
 @PreAuthorize("hasAuthority('ADMIN')")
 @RequestMapping(value = "/json/marca/{id}", method = RequestMethod.GET)
 public @ResponseBody Marca marcaJSON(@PathVariable long id, Model model) {
   return mar.findOne(id);
 }