Exemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getUser(java.lang.String
   * , boolean)
   */
  @Transactional(readOnly = true)
  public User getUserWithDependent(String id, boolean dependants) {

    UserEntity usr = userDao.findById(id);
    if (usr == null) {
      return null;
    }

    if (!dependants) {
      return userDozerConverter.convertToDTO(usr, true);
    }

    // assemble the various dependant objects
    org.hibernate.Hibernate.initialize(usr.getPhones());
    org.hibernate.Hibernate.initialize(usr.getEmailAddresses());
    org.hibernate.Hibernate.initialize(usr.getAddresses());
    org.hibernate.Hibernate.initialize(usr.getUserAttributes());
    User user = userDozerConverter.convertToDTO(usr, true);
    List<Login> principalList = loginDao.findUser(id);
    if (principalList != null) {
      user.setPrincipalList(principalList);
    }

    return user;
  }
Exemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addUser(org.openiam
   * .idm.srvc.user.dto.User, boolean)
   */
  @Transactional
  public User addUserWithDependent(User user, boolean dependency) {
    if (user == null) throw new NullPointerException("user object is null");

    if (user.getCreateDate() == null) {
      user.setCreateDate(new Date(System.currentTimeMillis()));
    }
    if (user.getLastUpdate() == null) {
      user.setLastUpdate(new Date(System.currentTimeMillis()));
    }

    // if there are dependants, then make user that the parentId has been
    // set

    validateEmailAddress(user, user.getEmailAddresses());

    log.debug("User Object before addUser: "******"ADD");

    return userDozerConverter.convertToDTO(entity, true);
  }
Exemplo n.º 3
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addUser(org.openiam
   * .idm.srvc.user.dto.User)
   */
  @Transactional
  public User addUser(User user) {
    if (user == null) throw new NullPointerException("user object is null");

    if (user.getCreateDate() == null) {
      user.setCreateDate(new Date(System.currentTimeMillis()));
    }
    if (user.getLastUpdate() == null) {
      user.setLastUpdate(new Date(System.currentTimeMillis()));
    }

    validateEmailAddress(user, user.getEmailAddresses());
    UserEntity userEntity = userDozerConverter.convertToEntity(user, true);
    userDao.add(userEntity);

    return userDozerConverter.convertToDTO(userEntity, true);
  }
Exemplo n.º 4
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getUser(java.lang.String
  * )
  */
 @Transactional(readOnly = true)
 public User getUser(String id) {
   UserEntity entity = userDao.findById(id);
   return userDozerConverter.convertToDTO(entity, true);
 }
Exemplo n.º 5
0
 @Transactional(readOnly = true)
 public User getUserByName(String firstName, String lastName) {
   UserEntity userEntity = userDao.findByName(firstName, lastName);
   return userDozerConverter.convertToDTO(userEntity, true);
 }