Package org.sete.service

Examples of org.sete.service.BusinessRuleException


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


        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

      }

        SeteUser su = userDao.findByLoginName(vo.getLoginName());

       if(vo.getUserRoles().length < 1){
        BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("seteUser.NoRolesSelected", new String[]{vo.getLoginName()});
        throw bre;
      }
     
      su.setFirstName(vo.getFirstName());
      su.setMiddleName(vo.getMiddleName());
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

     *  or have mismatched password attributes.
     */
    private void validateUser(CreateSeteUserVo vo) throws BusinessRuleException {
      /* Verify Non violation of Business Rules */
      if(vo.getPassword().equals("") || vo.getPassword2().equals("")){
        BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("seteUser.PasswordEmpty", new String[]{""});
        throw bre;
      }
      else 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;
      }
      else if(vo.getUserRoles().length < 1){
        BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("seteUser.NoRolesSelected", new String[]{vo.getLoginName()});
        throw bre;
      }     
    }
View Full Code Here

        }
        catch(Exception e){
          // only duplicate email address will invoke the following exception
          if(e instanceof DataIntegrityViolationException)
          { 
            BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("seteUser.EmailAlreadyExists", new String[]{csupvo.getEmailAddress()});
            throw bre;
          }
        }

    }
View Full Code Here

            }
            catch(Exception e){
              // only duplicate email address will invoke the following exception
              if(e instanceof DataIntegrityViolationException)
              { 
                BusinessRuleException bre = new BusinessRuleException();
                bre.addCodedMessage("seteUser.EmailAlreadyExists", new String[]{csupvo.getEmailAddress()});
                throw bre;
              }
             }
    }
View Full Code Here

        // old password validation
        String oldPassword = su.getPassword() ;
        String userFormOldPassword = passwordEncoder.encodePassword(csupvo.getOldPassword(), null) ;
        if(!oldPassword.equals(userFormOldPassword))
        {
          BusinessRuleException bre = new BusinessRuleException();
      bre.addCodedMessage("seteUser.OldPasswordInvalid");
      throw bre;
        }

        // new password
        su.setPassword(passwordEncoder.encodePassword(csupvo.getNewPassword(), null));
View Full Code Here

     * @see org.sete.service.project.ScienceProjectCategoryService#createNewScienceProjectCategory(org.sete.vo.project.CreateScienceProjectCategoryVo)
     */
    public void createNewScienceProjectCategory(CreateScienceProjectCategoryVo vo) {

      if(projectCategoryDao.findByProjectCategoryName(vo.getProjectCategoryName()) != null){
        BusinessRuleException bre = new BusinessRuleException();
        bre.addCodedMessage("projectCategory.nameAlreadyExists", new String[]{vo.getProjectCategoryName()});
        throw bre;
      }
     
      ScienceProjectCategoryType spc = new ScienceProjectCategoryType();
        spc.setLabel(vo.getProjectCategoryName()) ;
View Full Code Here

     * @see org.sete.service.project.ScienceProjectCategoryService#deleteScienceProjectCategory(org.sete.domain.type.ScienceProjectCategoryType)
     */
    public void deleteScienceProjectCategory(ScienceProjectCategoryType spct){
       
      if(projectCategoryDao.isProjectCategoryInUse(spct.getId())){
        BusinessRuleException bre2 = new BusinessRuleException();
        bre2.addCodedMessage("projectCategory.inUse", new String[]{spct.getLabel()});
        throw bre2;
        }
      projectCategoryDao.deleteScienceProjectCategory(spct);
    }
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.