public String removeUser(Long id) { userToRemove = registrationDao.getEntityManager().find(User.class, id); registrationDao.remove(userToRemove); MessageService.displayFacesMessageInfo( "registration_properties", "REGISTRATION_REMOVED_SUMMARY", "REGISTRATION_REMOVED_DETAIL"); allUsersByCreationDate = registrationDao.findAllUsersByRegistrationDate(); userToRemove = null; return REMOVE_PATH; }
public String prepareUpdateUser(Long id) { userListToUpdate = new ArrayList<User>(); userToUpdate = registrationDao.getEntityManager().find(User.class, id); userName = userToUpdate.getUserName(); firstName = userToUpdate.getFirstName(); lastName = userToUpdate.getLastName(); email = userToUpdate.getEmail(); prepareUpdatedRolePickup(); prepareUpdatedGroupPickup(); userListToUpdate.add(userToUpdate); allUsersByCreationDate = registrationDao.findAllUsersByRegistrationDate(); sortPickup(); return UPDATE_PATH; }
// ################################################################### // 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"; }
// ################################################################### // constructors // ################################################################### public RegistrationController() { initBasicRoles(); initBasicGroups(); allUsersByCreationDate = registrationDao.findAllUsersByRegistrationDate(); }