Examples of BusinessRuleException


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

Examples of net.sf.esims.exception.BusinessRuleException

  }

  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

Examples of net.sf.esims.exception.BusinessRuleException

    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

Examples of net.sf.esims.exception.BusinessRuleException

    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

Examples of net.sf.esims.exception.BusinessRuleException

   * @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

Examples of net.sf.esims.exception.BusinessRuleException


 
  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

Examples of org.mod4j.runtime.exception.BusinessRuleException

                BindException errors = new BindException(this, ClassUtils
                        .getShortNameAsProperty(this.getClass()));
                errors.reject("organisatie.casusoverleg.toekomst", new Object[] { element },
                        "organisatie mag niet worden verwijderd als er"
                                + " nog casusoverleggen gevoerd zullen worden in de toekomst");
                throw new BusinessRuleException(errors);
            }
        }
        return super.removeFromOrganisaties(element);
    }
View Full Code Here

Examples of org.sete.service.BusinessRuleException

        Set<SeteUser> students = new HashSet<SeteUser>();

        // Student creating project cannot be in another project already
        if(projectDao.isStudentInAnotherProject(Integer.valueOf(vo.getCreator()))) {
            BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("scienceProject.error.student.already.projectMember",
                                new String[] {"You"});
            throw bre;
        }

        students.add(userDao.findById(Integer.valueOf(vo.getCreator())));

        // Partner, if exists, cannot be involved with another project and cannot be the same person as
        // the Student creating this project.
        if(StringUtils.isNotBlank(vo.getPartner())) {
            if(projectDao.isStudentInAnotherProject(Integer.valueOf(vo.getPartner()))) {
                BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("scienceProject.error.student.already.projectMember",
                                    new String[]{"Partner"});
              throw bre;
            }

            if(vo.getPartner().equals(vo.getCreator())) {
                BusinessRuleException bre = new BusinessRuleException();
                bre.addCodedMessage("scienceProject.error.adding.student.moreThanOnce");
                throw bre;
            }

            students.add(userDao.findById(Integer.valueOf(vo.getPartner())));
        }
View Full Code Here

Examples of org.sete.service.BusinessRuleException

        Set<SeteUser> students = new HashSet<SeteUser>();

        // Student creating project cannot be in another project already
        if(projectDao.isStudentInAnotherProject(Integer.valueOf(vo.getCreator()))) {
            BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("scienceProject.error.student.already.projectMember",
                                new String[] {"You"});
            throw bre;
        }

        students.add(userDao.findById(Integer.valueOf(vo.getCreator())));

        // Partner, if exists, cannot be involved with another project and cannot be the same person as
        // the Student creating this project.
        if(StringUtils.isNotBlank(vo.getPartner())) {
            if(projectDao.isStudentInAnotherProject(Integer.valueOf(vo.getPartner()))) {
                BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("scienceProject.error.student.already.projectMember",
                                    new String[]{"Partner"});
              throw bre;
            }

            if(vo.getPartner().equals(vo.getCreator())) {
                BusinessRuleException bre = new BusinessRuleException();
                bre.addCodedMessage("scienceProject.error.adding.student.moreThanOnce");
                throw bre;
            }

            students.add(userDao.findById(Integer.valueOf(vo.getPartner())));
        }
View Full Code Here

Examples of org.sete.service.BusinessRuleException

          projectDao.saveScienceProject(sp);
      }
    }
 
    private void checkEditBusinessRules(CreateScienceProjectVo vo) throws BusinessRuleException {
      BusinessRuleException bre = new BusinessRuleException();
       if(vo == null) {
        throw new IllegalArgumentException("Cannot update a null ScienceProject.");
      }
       if(StringUtils.isNotBlank(vo.getCreator())) {
         SeteUser creator = userDao.findById(Integer.valueOf(vo.getCreator()));
         if( projectDao.isStudentInAnotherProject(Integer.valueOf(vo.getCreator())) &&
           !(projectDao.findBy(creator).getIdAsString().equals(vo.getProjId())) ){
           bre.addCodedMessage("scienceProject.error.student.already.projectMember",
                        new String[]{creator.getFirstName() + " " + creator.getLastName()});
           throw bre;
         }
       }
       if(StringUtils.isNotBlank(vo.getPartner())){
         SeteUser partner = userDao.findById(Integer.valueOf(vo.getPartner()));
         if( projectDao.isStudentInAnotherProject(Integer.valueOf(vo.getPartner())) &&
           !(projectDao.findBy(partner).getIdAsString().equals(vo.getProjId())) ){
           bre.addCodedMessage("scienceProject.error.student.already.projectMember",
                        new String[]{partner.getFirstName() + " " + partner.getLastName()});
           throw bre;
         }        
       }
        
       if(StringUtils.isNotBlank(vo.getPartner()) &&
         vo.getCreator().equals(vo.getPartner())){
           bre = new BusinessRuleException();
              bre.addCodedMessage("scienceProject.error.adding.student.moreThanOnce");
              throw bre;
       }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.