Ejemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getDefaultAddress(java
   * .lang.String)
   */
  @Transactional(readOnly = true)
  public Address getDefaultAddress(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");
    AddressEntity addressEntity = addressDao.findDefault(userId, ContactConstants.PARENT_TYPE_USER);

    return addressDozerConverter.convertToDTO(addressEntity, true);
  }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getAddressList(java
   * .lang.String)
   */
  @Transactional(readOnly = true)
  public List<Address> getAddressList(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");
    List<Address> addressList = null;
    List<AddressEntity> addressEntityList =
        addressDao.findByParentAsList(userId, ContactConstants.PARENT_TYPE_USER);

    return addressDozerConverter.convertToDTOList(addressEntityList, false);
  }
Ejemplo n.º 3
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getAddressByName(java
   * .lang.String, java.lang.String)
   */
  @Transactional(readOnly = true)
  public Address getAddressByName(String userId, String addressName) {
    if (userId == null) throw new NullPointerException("userId is null");
    if (addressName == null) throw new NullPointerException("userId is null");

    AddressEntity addressEntity =
        addressDao.findByName(addressName, userId, ContactConstants.PARENT_TYPE_USER);
    return addressEntity != null ? addressDozerConverter.convertToDTO(addressEntity, true) : null;
  }
Ejemplo n.º 4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateAddress(org.openiam
   * .idm.srvc.continfo.dto.Address)
   */
  @Transactional
  public void updateAddress(Address val) {
    if (val == null) throw new NullPointerException("val is null");
    if (val.getAddressId() == null) throw new NullPointerException("AddressId is null");
    if (StringUtils.isEmpty(val.getParentId()))
      throw new NullPointerException("userId for the address is not defined.");
    if (val.getParentType() == null) {
      throw new NullPointerException("parentType for the address is not defined.");
    }

    addressDao.update(addressDozerConverter.convertToEntity(val, true));
  }
Ejemplo n.º 5
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addAddress(org.openiam
   * .idm.srvc.continfo.dto.Address)
   */
  @Transactional
  public Address addAddress(Address val) {
    if (val == null) throw new NullPointerException("val is null");

    if (StringUtils.isEmpty(val.getParentId()))
      throw new NullPointerException("userId for the address is not defined.");

    val.setParentType(ContactConstants.PARENT_TYPE_USER);

    AddressEntity addressEntity = addressDao.add(addressDozerConverter.convertToEntity(val, true));
    return addressDozerConverter.convertToDTO(addressEntity, true);
  }
Ejemplo n.º 6
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getAddressMap(java.
  * lang.String)
  */
 @Transactional(readOnly = true)
 public Map<String, Address> getAddressMap(String userId) {
   if (userId == null) throw new NullPointerException("userId is null");
   Map<String, Address> addressMap = null;
   Map<String, AddressEntity> addressEntityMap =
       addressDao.findByParent(userId, ContactConstants.PARENT_TYPE_USER);
   if (addressEntityMap != null) {
     addressMap = new HashMap<String, Address>();
     for (Map.Entry<String, AddressEntity> addressEntityEntry : addressEntityMap.entrySet()) {
       addressMap.put(
           addressEntityEntry.getKey(),
           addressDozerConverter.convertToDTO(addressEntityEntry.getValue(), true));
     }
   }
   return addressMap;
 }
Ejemplo n.º 7
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getAddressById(java
  * .lang.String)
  */
 @Transactional(readOnly = true)
 public Address getAddressById(String addressId) {
   if (addressId == null) throw new NullPointerException("addressId is null");
   AddressEntity addressEntity = addressDao.findById(addressId);
   return addressDozerConverter.convertToDTO(addressEntity, true);
 }
Ejemplo n.º 8
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#removeAllAddresses(
  * java.lang.String)
  */
 @Transactional
 public void removeAllAddresses(String userId) {
   if (userId == null) throw new NullPointerException("userId is null");
   addressDao.removeByParent(userId, ContactConstants.PARENT_TYPE_USER);
 }
Ejemplo n.º 9
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#removeAddress(org.openiam
  * .idm.srvc.continfo.dto.Address)
  */
 @Transactional
 public void removeAddress(Address val) {
   if (val == null) throw new NullPointerException("val is null");
   if (val.getAddressId() == null) throw new NullPointerException("AddressId is null");
   addressDao.remove(addressDozerConverter.convertToEntity(val, true));
 }