Package org.sete.service

Examples of org.sete.service.BusinessRuleException


        try {
            baseDao.delete(type);
        }
        catch(Exception e) {
            // assume there are dependencies
            BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("error.typeData.hasDependencies");
            throw bre;
        }
    }
View Full Code Here


        // Only non-significant Types can have their respective keys updated
        // The Label drives key generation
        if(type instanceof Significant) {
            if(!type.getLabel().equals(vo.getLabel())) {
                BusinessRuleException bre = new BusinessRuleException();
                bre.addCodedMessage("error.typeData.cannotChangeLabelForNonSignificant");
                throw bre;
            }
        }

        String key = generateNewKey(vo.getLabel());
        try {
            TypeUtil.forKey((Class<AbstractLookupType>)type.getClass(), key);

            // found something so now check to see if we are updating ourself or is it
            // really a violation.
            if(!type.getKey().equals(key)) {
                BusinessRuleException bre = new BusinessRuleException();
                bre.addCodedMessage("error.typeData.duplicateKey");
                throw bre;
            }

        }
        catch(IllegalArgumentException iad) {
View Full Code Here

    private void checkTypeKeyIsUnique(Class<AbstractLookupType> clazz, String key) {
        try {
            TypeUtil.forKey(clazz, key);

            BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("error.typeData.duplicateKey");
            throw bre;
        }
        catch(IllegalArgumentException iae) {
            // No duplicates so key is okay
        }
View Full Code Here

    public void createNewScienceProject(CreateScienceProjectVo vo) {

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

        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())));

        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

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.