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
  /*
   * (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));
  }
Ejemplo n.º 3
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);
  }
Ejemplo n.º 4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getEmailAddressList
   * (java.lang.String)
   */
  @Transactional(readOnly = true)
  public List<EmailAddress> getEmailAddressList(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");

    List<EmailAddressEntity> emailAddressEntityList =
        emailAddressDao.findByParentAsList(userId, ContactConstants.PARENT_TYPE_USER);

    return emailAddressDozerConverter.convertToDTOList(emailAddressEntityList, false);
  }
Ejemplo n.º 5
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));
  }
Ejemplo n.º 6
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;
  }
Ejemplo n.º 7
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);
 }