コード例 #1
0
 @RequestMapping(value = "/provider/products/{id}", method = RequestMethod.GET, params = "edit")
 public String edit(Model uiModel, @PathVariable("id") Long id) {
   Provider user = (Provider) userContext.getCurrentUser();
   Product product = productService.findOneByUser(user, id);
   uiModel.addAttribute("product", product);
   return USERPRODUCTSEDIT;
 }
コード例 #2
0
 @RequestMapping(value = "/provider/detail", method = RequestMethod.GET)
 public String findCurrentProvider(Model uiModel) {
   SiteUser user = userContext.getCurrentUser();
   Provider provider = providerService.findOne(user.getId());
   if (provider == null) {
     throw new UserNotFoundException();
   }
   uiModel.addAttribute("user", provider);
   return "user/provider/detail";
 }
コード例 #3
0
 @RequestMapping(value = "/provider/detail", method = RequestMethod.PUT)
 public String updateCurrentProvider(
     Model uiModel, @ModelAttribute("user") Provider provider, BindingResult bindingResult) {
   if (bindingResult.hasErrors()) {
     uiModel.addAttribute("user", provider);
     return "user/provider/detail";
   }
   SiteUser user = userContext.getCurrentUser();
   provider.setId(user.getId());
   provider = providerService.updateProvider(provider);
   uiModel.addAttribute("user", provider);
   return "user/provider/detail";
 }