/* * (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); }
/* * (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); }
/* * (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); }
/* * (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; }