Package net.sourceforge.stripes.validation

Examples of net.sourceforge.stripes.validation.LocalizableError


     * username entered is not already taken in the system.
     */
    @ValidationMethod
    public void validate(ValidationErrors errors) {
        if ( new PersonManager().getPerson(this.user.getUsername()) != null ) {
            errors.add("user.username", new LocalizableError("usernameTaken"));
        }
    }
View Full Code Here


      if (days > 365)
        throw new BusinessRuleException(
            "An academic year cannot be more than 365 days");
    } catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("endDate", new LocalizableError(
          "/admin/academicyear/tooLong"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
    try {
      if (days < 279)
        throw new BusinessRuleException(
            "An academic year cannot be less than 279 days");

    } catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("endDate", new LocalizableError(
          "/admin/academicyear/tooShort"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
View Full Code Here

      if (days > 365)
        throw new BusinessRuleException(
            "An academic year cannot be more than 365 days");
    } catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("endDate", new LocalizableError(
          "/admin/academicyear/tooLong"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
    try {
      if (days < 279)
        throw new BusinessRuleException(
            "An academic year cannot be less than 279 days");

    } catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("endDate", new LocalizableError(
          "/admin/academicyear/tooShort"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
View Full Code Here

   
    //Check if all dates of exam fall in range of start and end date.
    for(IndividualExam iexam : this.individualExams){
      if(EsimsUtils.compareDates(this.startDate, iexam.getDateOfExam())>0){
        ValidationErrors errors = new ValidationErrors();
        errors.add("individualExams", new LocalizableError(
            "/admin/exam/InvalidDateOfExam"));
        getContext().setValidationErrors(errors);
       
        return getContext().getSourcePageResolution();
      }
      if(EsimsUtils.compareDates(this.endDate, iexam.getDateOfExam())<0){
        ValidationErrors errors = new ValidationErrors();
        errors.add("individualExams", new LocalizableError(
            "/admin/exam/InvalidDateOfExam"));
        getContext().setValidationErrors(errors);
        return getContext().getSourcePageResolution();
      }
    }
View Full Code Here

    if (listOfStandards.size() == 0) {
      ValidationErrors errors = new ValidationErrors();
      errors
      .add(
          "standardId",
          new LocalizableError(
          "/admin/division/DivisionMgmt.action.standardId.valueNotPresent"));
      this.getContext().setValidationErrors(errors);
    }
    this.getContext().setAttributeToSession("listOfStandards",
        listOfStandards);
View Full Code Here

      if(EsimsUtils.compareDates(new Date(), this.formIssuedOn)== -1)
        throw new BusinessRuleException("The date of issuing the form cannot be in the future");
    }
    catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("formIssuedOn", new LocalizableError("/officestaff/applicationforms/futureFormIssuedDate"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
    try{
      if(EsimsUtils.compareDates(new Date(), this.formReceivedOn)== -1)
        throw new BusinessRuleException("The date of receiving the form cannot be in the future");
    }
    catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("formReceivedOn", new LocalizableError("/officestaff/applicationforms/futureFormReceivedDate"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
    try{
      if(EsimsUtils.compareDates(this.formFilledOn, this.formIssuedOn)== -1)
        throw new BusinessRuleException("The date of filling the form cannot be earlier than the issual date");
    }
    catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("formReceivedOn", new LocalizableError("/officestaff/applicationforms/previousFormFillingDate"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
    try{
      if(EsimsUtils.compareDates(this.formIssuedOn, this.formReceivedOn)> 0)
        throw new BusinessRuleException("The date of receving the form cannot be earlier than issuance");
    }
    catch (BusinessRuleException businessRuleException) {
      ValidationErrors errors = new ValidationErrors();
      errors.add("formReceivedOn", new LocalizableError("/officestaff/applicationforms/earlierFormReceivedDate"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }
   
    String buttonName = "showParentDetailsPage";
View Full Code Here

    Calendar applicantBirthCal = Calendar.getInstance();
    applicantBirthCal.setTime(applicantDateOfBirth);
    int applicantBirthYear = applicantBirthCal.get(Calendar.YEAR);
    if(currentYear-applicantBirthYear < 5){
      ValidationErrors errors = new ValidationErrors();
      errors.add("applicantDateOfBirth", new LocalizableError("/office/issuedApplicationForm/LowAge"));
      getContext().setValidationErrors(errors);
      return getContext().getSourcePageResolution();
    }

    IssuedApplicationForm issuedApplicationForm = new IssuedApplicationForm(
View Full Code Here

    }

    @ValidationMethod(on = "changePassword")
    public void validate() {
        if (!newPassword.equals(newPasswordRetype)) {
            getContext().getValidationErrors().addGlobalError(new LocalizableError("passwordsNotMatch"));
        }
    }
View Full Code Here

    public Resolution changePassword() {
        try {
            adminService.authenticateUser(getContext().getUser().getEmail(), currentPassword, false);
        } catch (InvalidCredentialsException e) {
            getContext().getValidationErrors().add("currentPassword", new LocalizableError("currentPasswordNotValid"));
            return getContext().getSourcePageResolution();
        }
        adminService.changePassword(getContext().getUser(), newPassword);
        return new RedirectResolution(LogoutActionBean.class);
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.validation.LocalizableError

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.