Beispiel #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;
  }
Beispiel #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);
  }
Beispiel #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);
  }
Beispiel #4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateUser(org.openiam
   * .idm.srvc.user.dto.User)
   */
  @Transactional
  public void updateUser(User user) {
    if (user == null) throw new NullPointerException("user object is null");
    if (user.getUserId() == null) throw new NullPointerException("user id is null");

    user.setLastUpdate(new Date(System.currentTimeMillis()));

    userDao.update(userDozerConverter.convertToEntity(user, true));
  }
Beispiel #5
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#removeUser(java.lang
   * .String)
   */
  @Transactional
  public void removeUser(String id) {
    if (id == null) throw new NullPointerException("user id is null");

    User user = new User(id);

    // removes all the dependant objects.
    removeAllAttributes(id);
    removeAllPhones(id);
    removeAllAddresses(id);
    removeAllNotes(id);
    removeAllEmailAddresses(id);

    userDao.remove(userDozerConverter.convertToEntity(user, true));

    // / this.userMsgProducer.sendMessage(user.getUserId(),"DELETE");

  }
Beispiel #6
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateUser(org.openiam
   * .idm.srvc.user.dto.User, boolean)
   */
  @Transactional
  public void updateUserWithDependent(User user, boolean dependency) {
    if (user == null) throw new NullPointerException("user object is null");
    if (user.getUserId() == null) throw new NullPointerException("user id is null");

    user.setLastUpdate(new Date(System.currentTimeMillis()));

    validateEmailAddress(user, user.getEmailAddresses());

    userDao.update(userDozerConverter.convertToEntity(user, true));

    if (!dependency) return;

    // address
    /*
     * Map<Address> adrMap = user.getAddresses(); if (adrMap != null &&
     * adrMap.size() > 0 ) {
     * this.addressDao.saveAddressMap(user.getUserId(),
     * ContactConstants.PARENT_TYPE_USER , adrMap); }
     */
    // email
    /*
     * Map<String, EmailAddress> emailMap = user.getEmailAddresses(); if
     * (emailMap != null && emailMap.size() > 0 ) {
     * this.emailAddressDao.saveEmailAddressMap(user.getUserId(),
     * ContactConstants.PARENT_TYPE_USER , emailMap); }
     */
    // phone
    /*
     * Map<String, Phone> phoneMap = user.getPhones(); if (phoneMap != null
     * && phoneMap.size() > 0 ) {
     * this.phoneDao.savePhoneMap(user.getUserId(),
     * ContactConstants.PARENT_TYPE_USER , phoneMap); }
     */
    // this.userMsgProducer.sendMessage(user,"UPDATE");

  }
Beispiel #7
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);
 }
Beispiel #8
0
  @Transactional(readOnly = true)
  public List<User> searchByDelegationProperties(DelegationFilterSearch search) {
    List<UserEntity> entityList = userDao.findByDelegationProperties(search);

    return userDozerConverter.convertToDTOList(entityList, false);
  }
Beispiel #9
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#search(org.openiam.
   * util.db.Search)
   */
  @Transactional(readOnly = true)
  public List<User> search(UserSearch search) {
    List<UserEntity> entityList = userDao.search(search);

    return userDozerConverter.convertToDTOList(entityList, false);
  }
Beispiel #10
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#findUserByOrganization
   * (java.lang.String)
   */
  @Transactional(readOnly = true)
  public List<User> findUserByOrganization(String orgId) {
    List<UserEntity> entityList = userDao.findByOrganization(orgId);

    return userDozerConverter.convertToDTOList(entityList, false);
  }
Beispiel #11
0
 @Transactional(readOnly = true)
 public User getUserByName(String firstName, String lastName) {
   UserEntity userEntity = userDao.findByName(firstName, lastName);
   return userDozerConverter.convertToDTO(userEntity, true);
 }