示例#1
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);
  }
示例#2
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);
  }
示例#3
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);
  }
示例#4
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;
  }
示例#5
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));
  }
示例#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;
 }
示例#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);
 }
示例#8
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));
 }