Exemplo n.º 1
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));
  }
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#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");

  }
Exemplo n.º 5
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");

  }