Пример #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);
  }
Пример #2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateEmailAddress(
   * org.openiam.idm.srvc.continfo.dto.EmailAddress)
   */
  @Transactional
  public void updateEmailAddress(EmailAddress val) {
    if (val == null) throw new NullPointerException("val is null");
    if (val.getEmailId() == null) throw new NullPointerException("EmailAddressId is null");
    if (StringUtils.isEmpty(val.getParentId()))
      throw new NullPointerException("parentId for the address is not defined.");
    if (val.getParentType() == null) {
      throw new NullPointerException("parentType for the address is not defined.");
    }

    emailAddressDao.update(emailAddressDozerConverter.convertToEntity(val, true));
  }
Пример #3
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);
      }
    }
  }
Пример #4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#removeEmailAddress(
   * org.openiam.idm.srvc.continfo.dto.EmailAddress)
   */
  @Transactional
  public void removeEmailAddress(EmailAddress val) {
    if (val == null) throw new NullPointerException("val is null");
    if (val.getEmailId() == null) throw new NullPointerException("EmailAddressId is null");

    emailAddressDao.remove(emailAddressDozerConverter.convertToEntity(val, true));
  }