private Set<UserGroup> redefineGroups() { Set<UserGroup> userGroups = new HashSet<UserGroup>(userToUpdate.getGroups()); for (String newGroup : groupDefinitions.getSource()) { UserGroup userGroup = registrationDao.findGroupByGroupName(newGroup); userGroups.remove(userGroup); } for (String newGroup : groupDefinitions.getTarget()) { UserGroup userGroup = registrationDao.findGroupByGroupName(newGroup); userGroups.add(userGroup); } return userGroups; }
private Set<UserGroup> defineGroups() { Set<UserGroup> userGroups = new HashSet<UserGroup>(); for (String newGroup : groupDefinitions.getTarget()) { UserGroup userGroup = registrationDao.findGroupByGroupName(newGroup); userGroups.add(userGroup); } return userGroups; }