Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getDefaultEmailAddress
   * (java.lang.String)
   */
  @Transactional(readOnly = true)
  public EmailAddress getDefaultEmailAddress(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");

    EmailAddressEntity emailAddressEntity =
        emailAddressDao.findDefault(userId, ContactConstants.PARENT_TYPE_USER);
    return emailAddressDozerConverter.convertToDTO(emailAddressEntity, true);
  }
Пример #2
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);
  }
Пример #3
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getEmailAddressMap(
   * java.lang.String)
   */
  @Transactional(readOnly = true)
  public Map<String, EmailAddress> getEmailAddressMap(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");

    Map<String, EmailAddressEntity> emailAddressEntityMap =
        emailAddressDao.findByParent(userId, ContactConstants.PARENT_TYPE_USER);
    Map<String, EmailAddress> emailAddressMap = new HashMap<String, EmailAddress>();
    for (Map.Entry<String, EmailAddressEntity> addressEntityEntry :
        emailAddressEntityMap.entrySet()) {
      emailAddressMap.put(
          addressEntityEntry.getKey(),
          emailAddressDozerConverter.convertToDTO(addressEntityEntry.getValue(), true));
    }
    return emailAddressMap;
  }
Пример #4
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getEmailAddressById
  * (java.lang.String)
  */
 @Transactional(readOnly = true)
 public EmailAddress getEmailAddressById(String addressId) {
   if (addressId == null) throw new NullPointerException("addressId is null");
   EmailAddressEntity emailAddressEntity = emailAddressDao.findById(addressId);
   return emailAddressDozerConverter.convertToDTO(emailAddressEntity, true);
 }