// ################################################################### // business methods // ################################################################### public String saveUserRegistration() { if (!roleDefinitions.getTarget().isEmpty() && !groupDefinitions.getTarget().isEmpty()) { User newUser = defineBasicUserAttributes(); Set<Role> userRoles = defineRoles(); newUser.setRoles(userRoles); Set<UserGroup> userGroups = defineGroups(); newUser.setGroups(userGroups); registrationDao.persist(newUser); resetFields(); MessageService.displayFacesMessageInfo( "registration_properties", "REGISTRATION_SUCCESS_SUMMARY", "REGISTRATION_SUCCESS_DETAIL"); } allUsersByCreationDate = registrationDao.findAllUsersByRegistrationDate(); return "/pages/administration/registration/new.jsf"; }
public String updateUser(User user) { userToUpdate = user; userToUpdate.setModifiedOn(new Date()); User modifiedByUser = (User) SessionService.getSessionAttribute("user"); userToUpdate.setModifiedBy(modifiedByUser.getUserName()); Set<Role> userRoles = redefineRoles(); userToUpdate.setRoles(userRoles); Set<UserGroup> userGroups = redefineGroups(); userToUpdate.setGroups(userGroups); registrationDao.mergeUser(userToUpdate); sortPickup(); resetFields(); MessageService.displayFacesMessageInfo( "registration_properties", "REGISTRATION_USER_UPDATED_SUMMARY", "REGISTRATION_USER_UPDATED_DETAIL"); return UPDATE_PATH; }