Beispiel #1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addPhone(org.openiam
   * .idm.srvc.continfo.dto.Phone)
   */
  @Transactional
  public Phone addPhone(Phone 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);
    PhoneEntity phoneEntity = phoneDao.add(phoneDozerConverter.convertToEntity(val, true));
    return phoneDozerConverter.convertToDTO(phoneEntity, true);
  }
Beispiel #2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#removePhone(org.openiam
  * .idm.srvc.continfo.dto.Phone)
  */
 @Transactional
 public void removePhone(Phone val) {
   if (val == null) throw new NullPointerException("val is null");
   if (val.getPhoneId() == null) throw new NullPointerException("PhoneId is null");
   UserEntity parent = userDao.findById(val.getParentId());
   phoneDao.remove(phoneDozerConverter.convertToEntity(val, true));
 }
Beispiel #3
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getDefaultPhone(java
   * .lang.String)
   */
  @Transactional(readOnly = true)
  public Phone getDefaultPhone(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");

    PhoneEntity phoneEntity = phoneDao.findDefault(userId, ContactConstants.PARENT_TYPE_USER);
    return phoneDozerConverter.convertToDTO(phoneEntity, true);
  }
Beispiel #4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getPhoneById(java.lang
   * .String)
   */
  @Transactional(readOnly = true)
  public Phone getPhoneById(String addressId) {
    if (addressId == null) throw new NullPointerException("addressId is null");
    PhoneEntity phoneEntity = phoneDao.findById(addressId);

    return phoneDozerConverter.convertToDTO(phoneEntity, true);
  }
Beispiel #5
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getPhoneList(java.lang
   * .String)
   */
  @Transactional(readOnly = true)
  public List<Phone> getPhoneList(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");
    List<Phone> phoneList = null;
    List<PhoneEntity> phoneEntityList =
        phoneDao.findByParentAsList(userId, ContactConstants.PARENT_TYPE_USER);

    return phoneDozerConverter.convertToDTOList(phoneEntityList, true);
  }
Beispiel #6
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#updatePhone(org.openiam
  * .idm.srvc.continfo.dto.Phone)
  */
 @Transactional
 public void updatePhone(Phone val) {
   if (val == null) throw new NullPointerException("val is null");
   if (val.getPhoneId() == null) throw new NullPointerException("PhoneId 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.");
   }
   phoneDao.update(phoneDozerConverter.convertToEntity(val, true));
 }
Beispiel #7
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getPhoneMap(java.lang
  * .String)
  */
 @Transactional(readOnly = true)
 public Map<String, Phone> getPhoneMap(String userId) {
   if (userId == null) throw new NullPointerException("userId is null");
   Map<String, Phone> phoneMap = null;
   Map<String, PhoneEntity> phoneEntityMap =
       phoneDao.findByParent(userId, ContactConstants.PARENT_TYPE_USER);
   if (phoneEntityMap != null) {
     phoneMap = new HashMap<String, Phone>();
     for (Map.Entry<String, PhoneEntity> phoneEntityEntry : phoneEntityMap.entrySet()) {
       phoneMap.put(
           phoneEntityEntry.getKey(),
           phoneDozerConverter.convertToDTO(phoneEntityEntry.getValue(), true));
     }
   }
   return phoneMap;
 }