Package net.sf.esims.exception

Examples of net.sf.esims.exception.BusinessRuleException


   
  //validate nullable strings
  public static void validateNullableStrings(String str,int len) throws BusinessRuleException{
    if(! StringUtils.isEmpty(str)){
      if(str.length()>len)
        throw new BusinessRuleException(str+ " can be only a maximum of "+ len +" characters in length");
    }
  }
View Full Code Here


  }

  public void setAcademicYear(AcademicYear academicYear) {
   
    if (academicYear == null)
      throw new BusinessRuleException("The academic year cannot be null");
    if (academicYear.getAcademicYearId() == null)
      throw new BusinessRuleException(
          "The academic year's id cannot be null");
    this.academicYear = academicYear;
  }
View Full Code Here

    this.academicYear = academicYear;
  }

  public void setEndTime(String endTime) {
    if (endTime == null)
      throw new BusinessRuleException(
          "The end time for an entrance exam cannot be null");
    this.endTime = endTime;
  }
View Full Code Here

    this.entranceExamId = id;
  }

  public void setStartTime(String startTime) {
    if (startTime == null)
      throw new BusinessRuleException(
          "The start time for an entrance exam cannot be null");
    this.startTime = startTime;
  }
View Full Code Here

   * @param applicationFormEssence, the mandatory fields that are needed
   *
   */
  public ReceivedApplicationForm(ReceivedApplicationFormEssence applicationFormEssence){
    if(applicationFormEssence == null)
      throw new BusinessRuleException("The mandatory fields for an application form were found empty");
   
    this.academicYear=applicationFormEssence.getAcademicYear();
    this.formNumber=applicationFormEssence.getFormNumber();
    this.formIssuedOn=applicationFormEssence.getFormIssuedOn();
    this.formFilledOn=applicationFormEssence.getFormFilledOn();
View Full Code Here


 
  private void enforceBusinessRules(Role role, String userName, String userPassword, String firstName, String middleName, String lastName, String gender){
    if(role == null)
      throw new BusinessRuleException("The role to be associated with an user cannot be null");
    if(role.getRoleId()==null)
      throw new BusinessRuleException("The role to be associated with an user was not initialized properly ");
   
    if(StringUtils.isEmpty(firstName))
      throw new BusinessRuleException("User's first name cannot be blank");
    if(firstName.length()>32)
      throw new BusinessRuleException("User's first name can be only 32 characters in length");
    if(! firstName.matches("[a-zA-Z]*"))
      throw new BusinessRuleException("User's first name can consist of only A-Z or a-z");
   
    if(! StringUtils.isEmpty(middleName)){ 
      if(middleName.length()>32)
        throw new BusinessRuleException("User's middle name can be only 32 characters in length");
      if(! middleName.matches("[a-zA-Z]*"))
        throw new BusinessRuleException("User's middle name can consist of only A-Z or a-z");
    }
   
    if(StringUtils.isEmpty(lastName))
      throw new BusinessRuleException("User's last name cannot be blank");
    if(lastName.length()>32)
      throw new BusinessRuleException("User's last name can be only 32 characters in length");
    if(! lastName.matches("[a-zA-Z]*"))
      throw new BusinessRuleException("User's last name can consist of only A-Z or a-z");
   
   
    if(StringUtils.isEmpty(userName))
      throw new BusinessRuleException("User-name cannot be blank");
    if(userName.length()>32)
      throw new BusinessRuleException("User-name cannot be more than 32 characters");
    if(! userName.matches("[a-zA-Z0-9.]*"))
      throw new BusinessRuleException("User-name cannot contain other characters than a-z A-Z 0-9.");
   
    if(StringUtils.isEmpty(userPassword))
      throw new BusinessRuleException("Password  cannot be blank");
    if(userPassword.length()>64)
      throw new BusinessRuleException("Password cannot be more than 64 chars");
   
   
    if(StringUtils.isEmpty(gender))
      throw new BusinessRuleException("User's gender cannot be blank");
    if(gender.length()>1)
      throw new BusinessRuleException("User's gender can be only M/F");
     
    if(isActive == null)
      throw new BusinessRuleException("The User has to be either active/inactive");
  }
View Full Code Here

   * @param roleNameToBeSet
   */
  public void setRoleName(String roleNameToBeSet){
    //RoleName cannot be null
    if(isBlank(roleNameToBeSet))
      throw new BusinessRuleException("The Role name cannot be empty");     
    //Roles have to be in one of the categories
    if(! (roleNameToBeSet.equals(_ADMIN_ROLE) ||
        roleNameToBeSet.equals(_OFFICE_STAFF_ROLE) ||
        roleNameToBeSet.equals(_TEACHER_ROLE) ||
        roleNameToBeSet.equals(_PRINCIPAL_ROLE)) )
      throw new BusinessRuleException("The RoleName cannot be anything other than ADMIN, TEACHER, OFFICE_STAFF or PRINCIPAL");
    this.roleName=roleNameToBeSet;
  }
View Full Code Here



  public void setBelowPovertyLine(Boolean belowPovertyLine) {
    if(belowPovertyLine == null)
      throw new BusinessRuleException("BPL option cannot be null");
    this.belowPovertyLine = belowPovertyLine;
  }
View Full Code Here

  }


  public void setDateOfBirth(Date dateOfBirth) {
    if(dateOfBirth == null)
      throw new BusinessRuleException("Date of birth cannot be null");
    this.dateOfBirth = dateOfBirth;
  }
View Full Code Here

  }


  public void setGender(String gender) {
    if(gender == null)
      throw new BusinessRuleException("The students gender cannot be null");
    if( ! (gender.equalsIgnoreCase("M") || gender.equalsIgnoreCase("F") ) )
      throw new BusinessRuleException("The students gender can be only M or F");
    this.gender = gender;
  }
View Full Code Here

TOP

Related Classes of net.sf.esims.exception.BusinessRuleException

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.