예제 #1
0
  @Override
  protected boolean processFormSubmit(
      AjaxRequestTarget target, AdminBackingBean backingBean, AjaxEventType type) throws Exception {
    UserManageBackingBean userManageBackingBean = (UserManageBackingBean) backingBean;

    boolean eventHandled;

    try {
      User user = userManageBackingBean.getUser();
      eventHandled = false;

      if (type == USER_CREATED) {
        userService.persistNewUser(user, user.getPassword());
      } else if (type == USER_UPDATED) {
        userService.persistEditedUser(user);

        String password = user.getPassword();
        if (StringUtils.isNotBlank(password)) {
          userService.changePassword(user.getUsername(), password);
        }
      } else if (type == USER_DELETED) {
        deleteUser(userManageBackingBean);
      }
    } catch (ObjectNotUniqueException obnu) {
      backingBean.setServerMessage(obnu.getMessage());
      target.add(this);
      eventHandled = true;
    }

    return !eventHandled;
  }
예제 #2
0
 private void deleteUser(UserManageBackingBean userManageBackingBean) {
   userService.deleteUser(userManageBackingBean.getUser().getUserId());
 }