@Override
  protected void processRequest() throws Exception {
    UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());

    FormProcessor fp = new FormProcessor(request);
    int userId = fp.getInt(ARG_USERID);

    UserAccountBean u = (UserAccountBean) udao.findByPK(userId);

    String message;
    if (!u.isActive() || u.getAccountNonLocked()) {
      message = respage.getString("the_specified_user_not_exits");
    } else {
      u.setUpdater(ub);

      SecurityManager sm =
          ((SecurityManager)
              SpringServletAccess.getApplicationContext(context).getBean("securityManager"));
      String password = sm.genPassword();
      String passwordHash = sm.encrytPassword(password, getUserDetails());

      u.setPasswd(passwordHash);
      u.setPasswdTimestamp(null);
      u.setAccountNonLocked(Boolean.TRUE);
      u.setStatus(Status.AVAILABLE);
      u.setLockCounter(0);

      udao.update(u);

      if (udao.isQuerySuccessful()) {
        message = respage.getString("the_user_has_been_unlocked");

        try {
          sendRestoreEmail(u, password);
        } catch (Exception e) {
          message += respage.getString("however_was_error_sending_user_email_regarding");
        }
      } else {
        message = respage.getString("the_user_could_not_be_deleted_due_database_error");
      }
    }

    addPageMessage(message);
    forwardPage(Page.LIST_USER_ACCOUNTS_SERVLET);
  }
  protected void processRequest() throws Exception {
    UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());

    FormProcessor fp = new FormProcessor(request);
    int userId = fp.getInt(ARG_USERID);
    int action = fp.getInt(ARG_ACTION);

    UserAccountBean u = (UserAccountBean) udao.findByPK(userId);

    String message;
    if (!u.isActive()) {
      message = respage.getString("the_specified_user_not_exits");
    } else if (!EntityAction.contains(action)) {
      message = respage.getString("the_specified_action_on_the_user_is_invalid");
    } else if (!EntityAction.get(action).equals(EntityAction.DELETE)
        && !EntityAction.get(action).equals(EntityAction.RESTORE)) {
      message = respage.getString("the_specified_action_is_not_allowed");
    } else {
      EntityAction desiredAction = EntityAction.get(action);
      u.setUpdater(ub);

      if (desiredAction.equals(EntityAction.DELETE)) {
        udao.delete(u);

        if (udao.isQuerySuccessful()) {
          message = respage.getString("the_user_has_been_deleted");
          // YW 07-31-2007 << for feature that deletion doesn't need email the deleted user.
          /*
          //YW 07-26-2007 << catch exception (eg. timeout) and inform users.
          try {
          	sendDeleteEmail(u);
          } catch (Exception e) {
          	message += "  However, there has been an error sending the user an email regarding this deletion.";
          }
          */
          // YW >>
        } else {
          message = respage.getString("the_user_could_not_be_deleted_due_database_error");
        }
      } else {
        SecurityManager sm = SecurityManager.getInstance();
        String password = sm.genPassword();
        String passwordHash = sm.encrytPassword(password);

        u.setPasswd(passwordHash);
        u.setPasswdTimestamp(null);

        udao.restore(u);

        if (udao.isQuerySuccessful()) {
          message = respage.getString("the_user_has_been_restored");

          try {
            sendRestoreEmail(u, password);
          } catch (Exception e) {
            message += respage.getString("however_was_error_sending_user_email_regarding");
          }
        } else {
          message = respage.getString("the_user_could_not_be_deleted_due_database_error");
        }
      }
    }

    addPageMessage(message);
    forwardPage(Page.LIST_USER_ACCOUNTS_SERVLET);
  }