Ejemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addEmailAddress(org
   * .openiam.idm.srvc.continfo.dto.EmailAddress)
   */
  @Transactional
  public EmailAddress addEmailAddress(EmailAddress val) {
    if (val == null) throw new NullPointerException("val is null");
    if (StringUtils.isEmpty(val.getParentId()))
      throw new NullPointerException("parentId for the address is not defined.");

    val.setParentType(ContactConstants.PARENT_TYPE_USER);
    EmailAddressEntity emailAddressEntity = emailAddressDozerConverter.convertToEntity(val, true);
    emailAddressEntity = emailAddressDao.add(emailAddressEntity);
    return emailAddressDozerConverter.convertToDTO(emailAddressEntity, true);
  }
Ejemplo n.º 2
0
  private void validateEmailAddress(User user, Set<EmailAddress> emailSet) {

    if (emailSet == null || emailSet.isEmpty()) return;

    Iterator<EmailAddress> it = emailSet.iterator();

    while (it.hasNext()) {
      EmailAddress emailAdr = it.next();
      if (StringUtils.isEmpty(emailAdr.getParentId())) {
        emailAdr.setParentId(user.getUserId());
        emailAdr.setParentType(ContactConstants.PARENT_TYPE_USER);
      }
    }
  }