Package org.sete.service

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


        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

          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

        {
            saveNewAwardType(atVo);
        }
        catch(final Exception excp)
        {
            final BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("awardType.createError", new String[]{atVo.getType()});
           
            throw bre;
        }
       
        return mapping.findForward(WebConstants.FORWARD_VIEW);
View Full Code Here

          // 5 minutes over for the scorer who set the scoring in progress, now this user can set it to in progress
          sp.setScienceProjectStatusType(ScienceProjectStatusType.forKey(ScienceProjectStatusType.Key.SCORINGINPROGRESS_KEY));
          sp.setStatusChangedBy(Integer.valueOf(spvo.getScorer()));
        }
        else{
          BusinessRuleException bre = new BusinessRuleException();
          bre.addCodedMessage("scienceProject.error.scoringInProgress",new String[]{sp.getName()});
          throw bre;
        }
      }
    } 
     
View Full Code Here

        {
            saveDeletedAwardType(key);
        }
        catch(final Exception excp)
        {
            final BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("awardType.deleteError", new String[]{key});
           
            throw bre;
        }
       
        return mapping.findForward( "view" );
View Full Code Here

          // 5 minutes over for the scorer who set the scoring in progress, now this user can set it to in progress
          sp.setScienceProjectStatusType(ScienceProjectStatusType.forKey(ScienceProjectStatusType.Key.SCORINGINPROGRESS_KEY));
          sp.setStatusChangedBy(Integer.valueOf(scorer));
        }
        else{
          BusinessRuleException bre = new BusinessRuleException();
          bre.addCodedMessage("scienceProject.error.scoringInProgress",new String[]{sp.getName()});
          throw bre;
        }
      }
    }   
}
View Full Code Here

            if(log.isErrorEnabled()) {
                log.error(msg);
            }
           
            BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("projectIdea.doesNotExist", new String[]{projectIdeaId});
            throw bre;         
        }
        return vo;
    }
View Full Code Here

        {
            service.createNewScienceProjectFileType(cspftvo);
        }
        catch(final Exception excp)
        {
            final BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("projectFileType.exists", new String[]{key});

            throw bre;
        }

        TypeLoader.initializeSystemTypes(super.getServletContext());
View Full Code Here

     * @throws BusinessRuleException
     */
    private void validateUser(CreateSeteUserVo vo) throws BusinessRuleException {
      /* Verify Non violation of Business Rules */
      if(userDao.findByLoginName(vo.getLoginName()) != null){
        BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("seteUser.LoginAlreadyExists", new String[]{vo.getLoginName()});
        throw bre;
      }
      else if(!vo.getPassword().equals(vo.getPassword2())){
        BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("seteUser.PasswordMismatch", new String[]{""});
        throw bre;
      }
    }
View Full Code Here

TOP

Related Classes of org.sete.service.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.