Package org.sete.domain

Examples of org.sete.domain.SeteUser


    private void createUser(String fn, String mn, String ln, String addr, String pn, String eaddr,
                            String roleKey,
                            List<String> privKeys,
                            List<String> actionKeys) {

        SeteUser user = new SeteUser();
        user.setFirstName(fn);
        user.setMiddleName(mn);
        user.setLastName(ln);
        user.setDateOfBirth(new Date());
        user.setLoginName(fn);
        user.setPassword(passwordEncoder.encodePassword("sete", null));

        ContactInformation ci = new ContactInformation();
        ci.setAddress(addr);
        ci.setEmailAddress(eaddr);
        ci.setPhoneNumber(pn);
        user.setContactInformation(ci);

        Set<UserRolePrivilege> rolePrivs = new HashSet<UserRolePrivilege>();
        UserRolePrivilege p = new UserRolePrivilege();
        p.setUserRoleType(TypeUtil.forKey(UserRoleType.class, roleKey));

        Set<UserPrivilege> privs = new HashSet<UserPrivilege>();
        UserPrivilege up = null;

        for(String pk : privKeys) {
            up = new UserPrivilege();
            up.setUserPrivilegeType(TypeUtil.forKey(UserPrivilegeType.class, pk));
            for(String ak : actionKeys) {
                up.setPrivilegeActionType(TypeUtil.forKey(PrivilegeActionType.class, ak));
            }
            privs.add(up);
        }

        p.setUserPrivileges(privs);
        rolePrivs.add(p);

        user.setUserRolePrivileges(rolePrivs);
        baseDao.saveOrUpdate(user);
    }
View Full Code Here


        projectDao = createMock(ScienceProjectDao.class);
        seteUserDao = createMock(SeteUserDao.class);
        service = new SeteUserServiceImpl();
             
        //setup some data
        testUser = new SeteUser();
        testUser.setId(10);
        testUser.setFirstName("Johnny");
        testUser.setLastName("Mohseni");
        testUser.setLoginName("Johnny");
        testUser.setPassword("sete");
View Full Code Here

    @Test
    public void testCreateSeteUserBRE1(){
       
      initTestParams();
     
        expect(userDao.findByLoginName(csuvo.getLoginName())).andStubReturn(new SeteUser());
        replay(userDao);
       
        try{
          service.createNewSeteUser(csuvo);
        }
View Full Code Here

    }
      return userRoles;
    }
   
    public SeteUserVo loadSeteUser(String creator) {
        SeteUser su = userDao.findById(Integer.valueOf(creator));
        return this.makeUserVo(su);
    }
View Full Code Here

    
      return vo;
    }
   
    public SeteUserVo getSeteUser(String userId, boolean forDisplay) {
        SeteUser su = userDao.findById(Integer.valueOf(userId));
        SeteUserVo vo = new SeteUserVo();
        if(su != null){
          vo = this.makeUserVo(su);
          vo.setUserRoles(this.extractUserRoles(new ArrayList<UserRolePrivilege> (su.getUserRolePrivileges()), forDisplay));
        } else {
          final String msg = "Invalid SeteUser [id=" + userId + "] " +
      "submitted for update, operation aborted.";

      if(log.isErrorEnabled()) {
View Full Code Here

        }
        return vo;
    }
   
    public boolean deleteSeteUser(String userId){
      SeteUser su = userDao.findById(Integer.valueOf(userId));
      if(su == null){       
      final String msg = "Invalid SeteUser [id=" + userId + "] " +
      "submitted for deletion, operation aborted.";

      if(log.isErrorEnabled()) {
View Full Code Here

        validateUser(vo);

        final Set<UserRolePrivilege> rolePrivs = buildUserRolePrivileges(vo);

        final SeteUser su = createSeteUser(vo);
        su.setUserRolePrivileges(rolePrivs);

        seteUserDao.saveSeteUser(su);

    }
View Full Code Here

    public void updateSeteUser(CreateSeteUserVo vo){
       if(vo == null) {
        throw new IllegalArgumentException("Cannot update a null SeteUser.");
      }

        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());
      su.setLastName(vo.getLastName());
      final Set<UserRolePrivilege> rolePrivs = buildUserRolePrivileges(vo);
      su.setUserRolePrivileges(rolePrivs);     

        seteUserDao.saveSeteUser(su);
    }
View Full Code Here

     * @return SeteUser - A seteUser Object.
     *
     * @throws DataAccessException thrown if fields of viewObject cannot be accessed.
     */
    private SeteUser createSeteUser(CreateSeteUserVo vo) throws DataAccessException {
      SeteUser su = new SeteUser();
      su.setFirstName(vo.getFirstName());
      su.setMiddleName(vo.getMiddleName());
      su.setLastName(vo.getLastName());

      su.setLoginName(vo.getLoginName());
      su.setPassword(passwordEncoder.encodePassword(vo.getPassword(), null));

      return su;
    }
View Full Code Here

    /*
     * load a Sete User
     * @see org.sete.service.admin.SeteUserProfileService#loadSeteUser(java.lang.String)
     */
    public SeteUserVo loadSeteUser(String creator) throws NullPointerException {
        SeteUser su = userDao.findById(Integer.valueOf(creator));
        SeteUserVo vo = new SeteUserVo();
     
        vo.setFirstName(su.getFirstName());
    vo.setMiddleName(su.getMiddleName());
    vo.setLastName(su.getLastName());
    vo.setLoginName(su.getLoginName());
     
    if(su.getContactInformation() == null)
      su.setContactInformation(new ContactInformation());
     
    vo.setAddress(su.getContactInformation().getAddress());
    vo.setEmailAddress(su.getContactInformation().getEmailAddress());
    vo.setPhoneNumber(su.getContactInformation().getPhoneNumber());
   
        return vo;
    }
View Full Code Here

TOP

Related Classes of org.sete.domain.SeteUser

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.