Beispiel #1
0
public class USERS {
  private int iduser = 0;
  private String firstName = "";
  private String login = "";
  private String password = "";
  private int isPwdChangeRequired = 0;
  private String expairyDate = new Date().toString();
  private String registeredDate = new Date().toString();
  private long businessId = 0;
  private String role = "";
  private int personalDetailsId = 0;
  private String timeSheetConfiguredTo = TimeSheetTypes.MONTHLY.name();

  int clientId = 0;
  int approvalStatus = 0;
  int isEmailValidated = 0;

  public int getIsEmailValidated() {
    return isEmailValidated;
  }

  public void setIsEmailValidated(int isEmailValidated) {
    this.isEmailValidated = isEmailValidated;
  }

  public String getTimeSheetConfiguredTo() {
    return timeSheetConfiguredTo;
  }

  public void setTimeSheetConfiguredTo(String timeSheetConfiguredTo) {
    this.timeSheetConfiguredTo = timeSheetConfiguredTo;
  }

  public int getApprovalStatus() {
    return approvalStatus;
  }

  public void setApprovalStatus(int approvalStatus) {
    this.approvalStatus = approvalStatus;
  }

  public int getClientId() {
    return clientId;
  }

  public void setClientId(int clientId) {
    this.clientId = clientId;
  }

  public int getIduser() {
    return iduser;
  }

  public void setIduser(int iduser) {
    this.iduser = iduser;
  }

  /** @return the firstName */
  public String getFirstName() {
    return firstName;
  }

  /** @param firstName the firstName to set */
  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }

  public String getLogin() {
    return login;
  }

  public void setLogin(String login) {
    this.login = login;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  /** @return the isPwdChangeRequired */
  public int getIsPwdChangeRequired() {
    return isPwdChangeRequired;
  }

  /** @param isPwdChangeRequired the isPwdChangeRequired to set */
  public void setIsPwdChangeRequired(int isPwdChangeRequired) {
    this.isPwdChangeRequired = isPwdChangeRequired;
  }

  public String getExpairyDate() {
    return expairyDate;
  }

  public void setExpairyDate(String expairyDate) {
    this.expairyDate = expairyDate;
  }

  public String getRegisteredDate() {
    return registeredDate;
  }

  public void setRegisteredDate(String registeredDate) {
    this.registeredDate = registeredDate;
  }

  public String getRole() {
    return role;
  }

  public void setRole(String role) {
    this.role = role;
  }

  public long getBusinessId() {
    return businessId;
  }

  public void setBusinessId(long businessId) {
    this.businessId = businessId;
  }

  /** @return the personalDetailsId */
  public int getPersonalDetailsId() {
    return personalDetailsId;
  }

  /** @param personalDetailsId the personalDetailsId to set */
  public void setPersonalDetailsId(int personalDetailsId) {
    this.personalDetailsId = personalDetailsId;
  }
}
Beispiel #2
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward();
    Login login = (Login) form;
    // This sets the app path
    getApplicationPath();
    getApplicationPathToOneUP();
    try {
      LoginCheck loginCheck = (LoginCheck) getSpringCTX().getBean("loginCheck");
      UserProfile userProfile = loginCheck.isLogin(login);
      HttpSession session = request.getSession();
      session.setAttribute("userProfile", userProfile);
      // ADMINS OR CHILDADMINS
      if (userProfile.isLoginStatus()) {
        if (userProfile.isSuperAdmin()) {
          forward = mapping.findForward("superAdminFunctions");
        } else if (userProfile.isAdmin() || userProfile.isChildAdmin()) {
          Calendar cal = Calendar.getInstance();
          int year = cal.get(1);
          int month = cal.get(2);
          log.info("Year : " + year + " Month : " + month);
          DateUtils du = new DateUtils(year, month);
          userProfile.setDu(du);

          forward = mapping.findForward("employeeRegistrationPendingApprovals");
          List<ListOrderedMap> employeeRegistrationPendingApprovals =
              getSpringCtxDoTransactionBean().listEmployeeRegistrationPendingApprovals(userProfile);
          List<Map> employeeTimesheetPendingApprovals =
              getSpringCtxDoTransactionBean()
                  .listEmployeeTimesheetPendingApprovals(getUserProfile(request));

          if (!employeeRegistrationPendingApprovals.isEmpty()) {
            log.info("forwarding to pending approvals sheet");
            putObjInRequest(
                "employeeRegistrationPendingApprovals",
                request,
                employeeRegistrationPendingApprovals);
            forward = mapping.findForward("employeeRegistrationPendingApprovals");
          } else if (!employeeTimesheetPendingApprovals.isEmpty()) {
            putObjInRequest(
                "employeeTimesheetPendingApprovals", request, employeeTimesheetPendingApprovals);
            forward = mapping.findForward("employeeTimesheetPendingApprovals");
          } else {
            forward = mapping.findForward("adminFunctions");
          }
          // MEMBERS OR EMPLOYEES
        } else {
          Calendar cal = Calendar.getInstance();
          int year = cal.get(1);
          int month = cal.get(2);
          log.info("Year : " + year + " Month : " + month);
          DateUtils du = new DateUtils(year, month);
          userProfile.setDu(du);

          if (userProfile.getApprovalStatus() == 2 || userProfile.getApprovalStatus() == 3)
            return mapping.findForward("memberFunctions");

          if (userProfile.getTimeSheetConfiguredTo().equals(TimeSheetTypes.DAYS15.name())) {

            forward = days15(request, forward, mapping);

          } else if (userProfile.getTimeSheetConfiguredTo().equals(TimeSheetTypes.MONTHLY.name())) {

            forward = monthly(userProfile, request, forward, mapping);

          } else if (userProfile.getTimeSheetConfiguredTo().equals(TimeSheetTypes.WEEKLY.name())) {

            forward = weekly(userProfile, request, forward, mapping);

          } else if (userProfile
              .getTimeSheetConfiguredTo()
              .equals(TimeSheetTypes.BIWEEKLY.name())) {

            forward = biWeekly(userProfile, request, forward, mapping);

          } else {
            mapping.findForward("memberFunctions");
          }
        }
      } else {
        log.info("Login Failed {}", userProfile.getLoginFailReason());
        errors.add("loginFail", new ActionMessage(userProfile.getLoginFailReason()));
        forward = mapping.findForward("failure");
      }

    } catch (Exception e) {
      e.printStackTrace();
      errors.add("name", new ActionMessage("id"));
    }

    if (!errors.isEmpty()) {
      saveErrors(request, errors);
    }

    return (forward);
  }