Package com.centraview.common

Examples of com.centraview.common.Validation


    // initialize new actionerror object
    ActionErrors errors = new ActionErrors();

    try
    {
      Validation validation = new Validation();

      if (this.getTitle() == null || this.getTitle().trim().length() <= 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Title"));
      }
     
View Full Code Here


    }

    try
    {
      // initialize validation
      Validation validation = new Validation();

      // invoice
      if (this.getOrderid() == null || this.getOrderid().trim().length() <= 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Order"));
      }
View Full Code Here

    // cache the form data
    convertItemLines();

    try {
      Validation validation = new Validation();
      validation.checkForMaxlength("label.account.expense.description", this
          .getExpenseDescription(), "error.application.maxlength", errors, 40);
      validation.checkForRequired("label.account.expense.entity", this.getEntity(),
          "error.application.required", errors);
      validation.checkForRequired("label.account.expense.employee", this.getEmployee(),
          "error.application.required", errors);
      // validation.checkForRequired("label.account.expense.project",this.getProject(),"error.application.required","",errors);

      boolean itemPresent = false;
      int counter = 0;
View Full Code Here

    ActionErrors errors = new ActionErrors();

    try
    {
      // initialize validation
      Validation validation = new Validation()

      if (this.getFirstName() == null || this.getFirstName().trim().length() <= 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Name"));
      }
     
View Full Code Here

    ActionErrors errors = new ActionErrors();
    HttpSession session = null;
    try
    {
      // initialize validation
      Validation validation = new Validation();

      validation.checkForRequired("label.hr.newtimesheet.reportingto", ((String)get("reportingTo")), "error.application.required", errors);
      validation.checkForRequired("label.hr.newtimesheet.employee", ((String)get("employee")), "error.application.required", errors);
      validation.checkForRequired("label.hr.newtimesheet.fromdate", ((String)get("fromday")), "error.application.required", errors);
      validation.checkForRequired("label.hr.newtimesheet.todate", ((String)get("toyear")), "error.application.required", errors);

      if (
        ((String)get("fromday") != null && ((String)get("fromday")).length() != 0) ||
         ((String)get("fromyear") != null && ((String)get("fromyear")).length() != 0) ||
         ((String)get("frommonth") != null && ((String)get("frommonth")).length() != 0)
         )
      {
        validation.checkForDate("label.hr.newtimesheet.fromdate", ((String)get("fromyear")), ((String)get("frommonth")), ((String)get("fromday")), "error.application.date", errors);
      }
      if (
         (((String)get("today")) != null && ((String)get("today")).length() !=0) ||
         (((String)get("toyear")) != null && ((String)get("toyear")).length() !=0) ||
         (((String)get("tomonth")) != null && ((String)get("tomonth")).length() !=0)
        )
        {
        validation.checkForDate("label.hr.newtimesheet.todate", ((String)get("toyear")), ((String)get("tomonth")), ((String)get("today")), "error.application.date", errors);
      }

      if(((String)get("fromday")) != null && ((String)get("fromday")).length() != 0 && ((String)get("today")) != null && ((String)get("today")).length() !=0)
        validation.checkForDateComparison ("label.hr.newtimesheet.fromdate", ((String)get("fromyear")), ((String)get("frommonth")),((String)get("fromday")), "label.hr.newtimesheet.todate", ((String)get("toyear")), ((String)get("tomonth")), ((String)get("today")), "error.application.datecomparison", errors);

      session = request.getSession(true);

    }
    catch(Exception e)
View Full Code Here

    // cache the form data
    convertItemLines();

    try {
      // initialize validation
      Validation validation = new Validation();

      validation.checkForRequired("label.hrs.hr.ReportingTo", reportto,
          "error.application.required", errors);

      validation.checkForRequired("label.hrs.hr.Employee", getEmployee(),
          "error.application.required", errors);

      validation.checkForRequired("label.hrs.hr.From", getFromday(), "error.application.required",
          errors);
      validation.checkForRequired("label.hrs.hr.To", getToday(), "error.application.required",
          errors);

      if ((getFromday() != null && getFromday().length() != 0)
          || (getFromyear() != null && (getFromyear()).length() != 0)
          || (getFrommonth() != null && (getFrommonth()).length() != 0)) {
        validation.checkForDate("label.hrs.hr.From", getFromyear(), getFrommonth(), getFromday(),
            "error.application.date", errors);
      }
      if ((getToday() != null && getToday().length() != 0)
          || (getToyear() != null && getToyear().length() != 0)
          || (getTomonth() != null && getTomonth().length() != 0)) {
        validation.checkForDate("label.hrs.hr.To", getToyear(), getTomonth(), getToday(),
            "error.application.date", errors);
      }

      if ((getFromday()) != null
          && (getFromday().length() != 0 && (getToday()) != null && (getToday()).length() != 0))
        validation.checkForDateComparison("label.hrs.hr.From", (getFromyear()), (getFrommonth()),
            (getFromday()), "label.hrs.hr.To", (getToyear()), (getTomonth()), (getToday()),
            "error.application.datecomparison", errors);
      boolean itemPresent = false;
      int counter = 0;
View Full Code Here

     * @return ActionErrors
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
    {
        ActionErrors errors = new ActionErrors();
        Validation validation = new Validation();
        validation.checkForRequired("label.reports.name", getName(), "error.application.required", errors);
        return errors;
    }
View Full Code Here

    ActionErrors errors = new ActionErrors();

    try
    {
      // initialize validation
      Validation validation = new Validation();

      this.convertPaymentLines();

      if (this.getEntityId() == null || this.getEntityId().trim().length() <= 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Entity"));
View Full Code Here

  {
    ActionErrors errors = new ActionErrors();

    try {
      // initialize validation
      Validation validation = new Validation();

      // subject
      if (this.getSubject() == null || this.getSubject().trim().length() <= 0) {
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.general.requiredField", "Subject"));
      }
View Full Code Here

        sessionForm.setActivityFile(this.getActivityFile());
        sessionForm.setActivityFilesList(this.getActivityFilesList());
      }
      // initialize validation
      Validation validation = new Validation();

      validation.checkForRequired("error.activity.detail.title", sessionForm.getActivityTitle(),
          "error.application.required", errors);
      validation.checkForMaxlength("error.activity.detail.title", sessionForm.getActivityTitle(),
          "error.application.maxlength", errors, 255);

      if (sessionForm.getActivityRecurringFrequency() != null) {
        if (sessionForm.getActivityRecurringFrequency().equals("DAY")) {
          if (sessionForm.getActivityRecurringDailyDays() != null
              && sessionForm.getActivityRecurringDailyDays().equals("")) {
            validation.checkForRequired("label.activity.recurring.everyday", sessionForm
                .getActivityRecurringDailyDays(), "error.application.required", errors);
          }// end of if(sessionForm.getActivityRecurringDailyDays() != null &&
          // sessionForm.getActivityRecurringDailyDays().equals(""))
          if (sessionForm.getActivityRecurringDailyDays() != null
              && sessionForm.getActivityRecurringDailyDays().trim().equals("0")) {
            validation.checkForRequired("label.activity.recurring.everydayzero", sessionForm
                .getActivityRecurringDailyDays(), "error.application.required", errors);
          }// end of if(sessionForm.getActivityRecurringDailyDays() != null &&
          // sessionForm.getActivityRecurringDailyDays().trim().equals("0"))
        }// end of if
        // (sessionForm.getActivityRecurringFrequency().equals("DAY"))

        if (sessionForm.getActivityRecurringFrequency().equals("WEEK")) {
          if (sessionForm.getActivityRecurringWeeklyEvery() != null
              && sessionForm.getActivityRecurringWeeklyEvery().equals("")) {
            validation.checkForRequired("label.activity.recurring.everyday", sessionForm
                .getActivityRecurringWeeklyEvery(), "error.application.required", errors);
          }// end of if(sessionForm.getActivityRecurringWeeklyEvery() != null
          // && sessionForm.getActivityRecurringWeeklyEvery().equals(""))

          if (sessionForm.getActivityRecurringWeeklyEvery() != null
              && sessionForm.getActivityRecurringWeeklyEvery().trim().equals("0")) {
            validation.checkForRequired("label.activity.recurring.everydayzero", sessionForm
                .getActivityRecurringWeeklyEvery(), "error.application.required", errors);
          }// end of if(sessionForm.getActivityRecurringWeeklyEvery() != null
          // &&
          // sessionForm.getActivityRecurringWeeklyEvery().trim().equals("0"))
        }// end of if
        // (sessionForm.getActivityRecurringFrequency().equals("WEEK"))

        if (sessionForm.getActivityRecurringFrequency().equals("MONTH")) {
          if (sessionForm.getActivityRecurringMonthlyEvery().equals("0")) {
            if (sessionForm.getActivityRecurringMonthlyEveryDay() != null
                && sessionForm.getActivityRecurringMonthlyEveryDay().equals("")) {
              validation.checkForRequired("label.activity.recurring.everymonth", sessionForm
                  .getActivityRecurringMonthlyEveryDay(), "error.application.required", errors);
            }// end of if(sessionForm.getActivityRecurringMonthlyEveryDay() !=
            // null &&
            // sessionForm.getActivityRecurringMonthlyEveryDay().equals(""))
            if (sessionForm.getActivityRecurringMonthlyEveryDay() != null
                && sessionForm.getActivityRecurringMonthlyEveryDay().trim().equals("0")) {
              validation.checkForRequired("label.activity.recurring.everymonthzero", sessionForm
                  .getActivityRecurringMonthlyEveryDay(), "error.application.required", errors);
            }// end of if(sessionForm.getActivityRecurringMonthlyEveryDay() !=
            // null &&
            // sessionForm.getActivityRecurringMonthlyEveryDay().trim().equals("0"))
          }// end of if
          // (sessionForm.getActivityRecurringMonthlyEvery().equals("0"))
        }// end of if
        // (sessionForm.getActivityRecurringFrequency().equals("MONTH"))

        if (sessionForm.getActivityRecurringFrequency().equals("YEAR")) {
          if (sessionForm.getActivityRecurringYearlyEvery().equals("0")) {
            if (sessionForm.getActivityRecurringYearlyEveryDay() != null
                && sessionForm.getActivityRecurringYearlyEveryDay().equals("")) {
              validation.checkForRequired("label.activity.recurring.everymonth", sessionForm
                  .getActivityRecurringYearlyEveryDay(), "error.application.required", errors);
            }// end of if(sessionForm.getActivityRecurringYearlyEveryDay() !=
            // null &&
            // sessionForm.getActivityRecurringYearlyEveryDay().equals(""))

            if (sessionForm.getActivityRecurringYearlyEveryDay() != null
                && sessionForm.getActivityRecurringYearlyEveryDay().trim().equals("0")) {
              validation.checkForRequired("label.activity.recurring.everymonthzero", sessionForm
                  .getActivityRecurringYearlyEveryDay(), "error.application.required", errors);
            }// end of if(sessionForm.getActivityRecurringYearlyEveryDay() !=
            // null &&
            // sessionForm.getActivityRecurringYearlyEveryDay().trim().equals("0"))
          }// end of if
          // (sessionForm.getActivityRecurringYearlyEvery().equals("0"))
        }// end of if
        // (sessionForm.getActivityRecurringFrequency().equals("YEAR"))

      }// end of if (sessionForm.getActivityRecurringFrequency() != null)

      // if user have entered any data, then check for valid date
      if (sessionForm.getActivityStartDate() != null
          && sessionForm.getActivityStartDate().length() != 0) {
        validation.validateDateString("label.activity.detail.startdate", sessionForm
            .getActivityStartDate(), sessionForm.getLocale(), "error.application.date", errors);
      }
      if (sessionForm.getActivityStartTime() != null
          && sessionForm.getActivityStartTime().length() != 0) {
        validation.checkForTime("label.activity.detail.starttime", sessionForm
            .getActivityStartTime(), "error.application.time", errors, sessionForm.getLocale());
      }
      if (sessionForm.getActivityEndDate() != null
          && sessionForm.getActivityEndDate().length() != 0) {
        validation.validateDateString("label.activity.detail.enddate", sessionForm
            .getActivityEndDate(), sessionForm.getLocale(), "error.application.date", errors);
      }
      if (sessionForm.getActivityEndTime() != null && sessionForm.getActivityEndTime().length() != 0) {
        validation.checkForTime("label.activity.detail.endtime", sessionForm.getActivityEndTime(),
            "error.application.time", errors, sessionForm.getLocale());
      }
      // TODO verify END date/time is after Start date/time
      // remind date time
      if (sessionForm.getActivityReminder() != null
          && sessionForm.getActivityReminder().equals("ALERT")) {

        if (sessionForm.getActivityRemindDate() != null && sessionForm.getActivityRemindDate()
            .length() != 0) {
          validation.validateDateString("label.activity.detailremind.startdate", sessionForm
              .getActivityRemindDate(), sessionForm.getLocale(), "error.application.date", errors);
        }
        if (sessionForm.getActivityReminderTime() != null && sessionForm
                .getActivityReminderTime().length() != 0) {
          validation.checkForTime("label.activity.detailremind.starttime", sessionForm
              .getActivityReminderTime(), "error.application.time", errors, sessionForm.getLocale());
        }
      }// end of if (sessionForm.getActivityReminder() != null && ...)

      // check recur date/time validity
      if (sessionForm.getActivityRecurStartDate() != null && sessionForm
          .getActivityRecurStartDate().length() != 0) {
        validation.validateDateString("label.activity.recurring.startdate", sessionForm
            .getActivityRecurStartDate(), sessionForm.getLocale(), "error.application.date", errors);
      }

      if (sessionForm.getActivityRecurEndDate() != null && sessionForm
          .getActivityRecurEndDate().length() != 0) {
        validation.validateDateString("label.activity.recurring.enddate", sessionForm
            .getActivityRecurEndDate(), sessionForm.getLocale(), "error.application.date", errors);
      }
      // TODO verify recurring END date/time is after Start date/time
    } catch (Exception e) {
      logger.error("[validate]: Exception", e);
View Full Code Here

TOP

Related Classes of com.centraview.common.Validation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.