/* * (non-Javadoc) * * @see * org.openiam.idm.srvc.user.service.UserDataService#updateUser(org.openiam * .idm.srvc.user.dto.User) */ @Transactional public void updateUser(User user) { if (user == null) throw new NullPointerException("user object is null"); if (user.getUserId() == null) throw new NullPointerException("user id is null"); user.setLastUpdate(new Date(System.currentTimeMillis())); userDao.update(userDozerConverter.convertToEntity(user, true)); }
private void validateEmailAddress(User user, Set<EmailAddress> emailSet) { if (emailSet == null || emailSet.isEmpty()) return; Iterator<EmailAddress> it = emailSet.iterator(); while (it.hasNext()) { EmailAddress emailAdr = it.next(); if (StringUtils.isEmpty(emailAdr.getParentId())) { emailAdr.setParentId(user.getUserId()); emailAdr.setParentType(ContactConstants.PARENT_TYPE_USER); } } }
/* * (non-Javadoc) * * @see * org.openiam.idm.srvc.user.service.UserDataService#updateUser(org.openiam * .idm.srvc.user.dto.User, boolean) */ @Transactional public void updateUserWithDependent(User user, boolean dependency) { if (user == null) throw new NullPointerException("user object is null"); if (user.getUserId() == null) throw new NullPointerException("user id is null"); user.setLastUpdate(new Date(System.currentTimeMillis())); validateEmailAddress(user, user.getEmailAddresses()); userDao.update(userDozerConverter.convertToEntity(user, true)); if (!dependency) return; // address /* * Map<Address> adrMap = user.getAddresses(); if (adrMap != null && * adrMap.size() > 0 ) { * this.addressDao.saveAddressMap(user.getUserId(), * ContactConstants.PARENT_TYPE_USER , adrMap); } */ // email /* * Map<String, EmailAddress> emailMap = user.getEmailAddresses(); if * (emailMap != null && emailMap.size() > 0 ) { * this.emailAddressDao.saveEmailAddressMap(user.getUserId(), * ContactConstants.PARENT_TYPE_USER , emailMap); } */ // phone /* * Map<String, Phone> phoneMap = user.getPhones(); if (phoneMap != null * && phoneMap.size() > 0 ) { * this.phoneDao.savePhoneMap(user.getUserId(), * ContactConstants.PARENT_TYPE_USER , phoneMap); } */ // this.userMsgProducer.sendMessage(user,"UPDATE"); }