Example #1
0
  /*
   * (non-Javadoc)
   * @see net.rrm.ehour.persistence.persistence.ui.admin.BaseTabbedAdminPage#getNewAddBackingBean()
   */
  @Override
  protected UserBackingBean getNewAddBaseBackingBean() {
    UserBackingBean userBean;

    userBean = new UserBackingBean(new User(), AdminAction.NEW);
    userBean.getUser().setActive(true);

    return userBean;
  }
Example #2
0
  @Override
  protected void processFormSubmit(
      AjaxRequestTarget target, AdminBackingBean backingBean, AjaxEventType type) throws Exception {
    UserBackingBean userBackingBean = (UserBackingBean) backingBean;

    if (type == UserEditAjaxEventType.USER_UPDATED) {
      if (userBackingBean.getAdminAction() == AdminAction.NEW) {
        userService.newUser(userBackingBean.getUser(), userBackingBean.getUser().getPassword());
      } else {
        userService.editUser(userBackingBean.getUser());

        String password = userBackingBean.getUser().getPassword();
        if (StringUtils.isNotBlank(password)) {
          userService.changePassword(userBackingBean.getUser().getUsername(), password);
        }
      }
    } else if (type == UserEditAjaxEventType.USER_DELETED) {
      deleteUser(userBackingBean);
    }
  }
Example #3
0
 private void deleteUser(UserBackingBean userBackingBean) {
   userService.deleteUser(userBackingBean.getUser().getUserId());
 }