Ejemplo n.º 1
0
 private String create(UserDto user, RedirectAttributes redir, Model model) {
   try {
     UserDto dbUser = userBusinessLogic.create(user);
     redir.addFlashAttribute(
         "message", String.format("Successfully created user \"%s\". ", user.getFullName()));
     createParkingUser(dbUser, user);
   } catch (Exception e) {
     model.addAttribute("message", e.getMessage());
     model.addAttribute("user", new UserDto());
     model.addAttribute("action", "CREATE");
     return EDIT_PAGE;
   }
   return REDIRECT_MAIN_PAGE;
 }
Ejemplo n.º 2
0
 private String update(UserDto user, RedirectAttributes redir, Model model) {
   try {
     userBusinessLogic.update(user);
     redir.addFlashAttribute(
         "message", String.format("Successfully updated user \"%s\". ", user.getFullName()));
     updateParkingUser(user);
   } catch (Exception e) {
     model.addAttribute("message", e.getMessage());
     model.addAttribute("user", userBusinessLogic.findOneById(user.getId()));
     model.addAttribute("action", "UPDATE");
     return EDIT_PAGE;
   }
   return REDIRECT_MAIN_PAGE;
 }
Ejemplo n.º 3
0
 @RequestMapping(value = "/changepassword", method = RequestMethod.POST)
 public String changePassword(
     @ModelAttribute UserDto user, RedirectAttributes redir, Model model) {
   model.addAttribute("authority", loggedinUserRole());
   try {
     userBusinessLogic.updatePassword(user);
     redir.addFlashAttribute(
         "message",
         String.format("Successfully updated password of user \"%s\". ", user.getFullName()));
   } catch (Exception e) {
     model.addAttribute("message", e.getMessage());
     model.addAttribute("user", userBusinessLogic.findOneById(user.getId()));
     return USER_CHANGE_PASS_PAGE;
   }
   return REDIRECT_MAIN_PAGE;
 }