Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java =================================================================== diff -u -r11b64f81e406ff277c7c35988304b0064300de57 -r5bf2d3b201efb46864182d72901e497d0acb253f --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java (.../IIntegrationService.java) (revision 11b64f81e406ff277c7c35988304b0064300de57) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IIntegrationService.java (.../IIntegrationService.java) (revision 5bf2d3b201efb46864182d72901e497d0acb253f) @@ -92,8 +92,7 @@ * @param extUsername * @return */ - ExtUserUseridMap getExistingExtUserUseridMap(ExtServer extServer, String extUsername) - throws UserInfoFetchException; + ExtUserUseridMap getExistingExtUserUseridMap(ExtServer extServer, String extUsername) throws UserInfoFetchException; /** * Returns integration server by its automatically-created sid. @@ -110,12 +109,13 @@ * @return */ ExtServer getExtServer(String serverId); - + /** - * Returns ExtServerLessonMap for the LTI Tool Consumer identified by serverId. + * Returns ExtServerLessonMap for the LTI Tool Consumer identified by serverId. * * @param serverId - * @param resourceLinkId resource_link_id parameter from LTI request + * @param resourceLinkId + * resource_link_id parameter from LTI request * @return */ ExtServerLessonMap getLtiConsumerLesson(String serverId, String resourceLinkId); @@ -148,14 +148,14 @@ String lastName, String language, String country, String email, boolean prefix, boolean isUpdateUserDetails) throws UserInfoValidationException; - ExtUserUseridMap getImplicitExtUserUseridMap(ExtServer extServer, String extUsername, String password, - String salt, String firstName, String lastName, String email) throws UserInfoValidationException; + ExtUserUseridMap getImplicitExtUserUseridMap(ExtServer extServer, String extUsername, String password, String salt, + String firstName, String lastName, String email) throws UserInfoValidationException; /** * @return all available integrated servers (that is excluding tool consumers) */ List getAllExtServers(); - + /** * @return all available tool consumers */ @@ -172,21 +172,22 @@ void saveExtServerToolAdapterMap(ExtServerToolAdapterMap map); void deleteExtServerToolAdapterMap(ExtServerToolAdapterMap map); - + /** * Creates new ExtServerLessonMap object. Method is suitable for creating lessons via integration servers. * * @param lessonId * @param extServer */ void createExtServerLessonMap(Long lessonId, ExtServer extServer); - + /** * Creates new ExtServerLessonMap object. Method is suitable for creating lessons via LTI tool consumers as long as * they provide resourceLinkId as a parameter and not lessonId. * * @param lessonId - * @param resourceLinkId resource_link_id parameter sent by LTI tool consumer + * @param resourceLinkId + * resource_link_id parameter sent by LTI tool consumer * @param extServer */ void createExtServerLessonMap(Long lessonId, String resourceLinkId, ExtServer extServer); @@ -214,4 +215,11 @@ List getExtGroups(Long lessonId, String[] extGroupIds) throws Exception; ExtCourseClassMap getExtCourseClassMap(Integer sid, Long lessonId); -} + + /** + * Creates an external org and normal org. It does not set roles for the creator. + */ + ExtCourseClassMap createExtCourseClassMap(ExtServer extServer, Integer userId, String extCourseId, + String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, Boolean prefix) + throws UserInfoValidationException; +} \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java =================================================================== diff -u -rfebc5ec394566f98439ce776a0be320b34310b0a -r5bf2d3b201efb46864182d72901e497d0acb253f --- lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision febc5ec394566f98439ce776a0be320b34310b0a) +++ lams_common/src/java/org/lamsfoundation/lams/integration/service/IntegrationService.java (.../IntegrationService.java) (revision 5bf2d3b201efb46864182d72901e497d0acb253f) @@ -49,8 +49,8 @@ import org.lamsfoundation.lams.gradebook.GradebookUserLesson; import org.lamsfoundation.lams.gradebook.service.IGradebookService; import org.lamsfoundation.lams.integration.ExtCourseClassMap; -import org.lamsfoundation.lams.integration.ExtServerLessonMap; import org.lamsfoundation.lams.integration.ExtServer; +import org.lamsfoundation.lams.integration.ExtServerLessonMap; import org.lamsfoundation.lams.integration.ExtServerToolAdapterMap; import org.lamsfoundation.lams.integration.ExtUserUseridMap; import org.lamsfoundation.lams.integration.UserInfoFetchException; @@ -97,14 +97,16 @@ /** * Returns integration server or LTI tool consumer by its human-entered server key/server id. - * - * @param serverId server key/server id - * @param isIntegrationServer true in case this is an integration server, false - LTI tool consumer + * + * @param serverId + * server key/server id + * @param isIntegrationServer + * true in case this is an integration server, false - LTI tool consumer * @return */ @Override public ExtServer getExtServer(String serverId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("serverid", serverId); List list = service.findByProperties(ExtServer.class, properties); if (list == null || list.size() == 0) { @@ -116,7 +118,7 @@ @Override public ExtCourseClassMap getExtCourseClassMap(Integer sid, String extCourseId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("courseid", extCourseId); properties.put("extServer.sid", sid); List list = service.findByProperties(ExtCourseClassMap.class, properties); @@ -130,9 +132,9 @@ // wrapper method for compatibility with original integration modules @Override - public ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, - String extCourseId, String countryIsoCode, String langIsoCode, String prettyCourseName, String method, - Boolean prefix) throws UserInfoValidationException { + public ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, String extCourseId, + String countryIsoCode, String langIsoCode, String prettyCourseName, String method, Boolean prefix) + throws UserInfoValidationException { // Set the pretty course name if available, otherwise maintain the extCourseId String courseName = ""; @@ -141,7 +143,7 @@ } else { courseName = extCourseId; } - + Boolean isTeacher = (StringUtils.equals(method, LoginRequestDispatcher.METHOD_AUTHOR) || StringUtils.equals(method, LoginRequestDispatcher.METHOD_MONITOR)); return getExtCourseClassMap(extServer, userMap, extCourseId, courseName, countryIsoCode, langIsoCode, @@ -150,8 +152,8 @@ // wrapper method for compatibility with original integration modules @Override - public ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, - String extCourseId, String countryIsoCode, String langIsoCode, String prettyCourseName, String method) + public ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, String extCourseId, + String countryIsoCode, String langIsoCode, String prettyCourseName, String method) throws UserInfoValidationException { return getExtCourseClassMap(extServer, userMap, extCourseId, countryIsoCode, langIsoCode, prettyCourseName, method, true); @@ -160,24 +162,18 @@ // newer method which accepts course name, a parent org id, a flag for whether user should get // 'teacher' roles, and a flag for whether to use a prefix in the org's name @Override - public ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, - String extCourseId, String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, - Boolean isTeacher, Boolean prefix) throws UserInfoValidationException { + public ExtCourseClassMap getExtCourseClassMap(ExtServer extServer, ExtUserUseridMap userMap, String extCourseId, + String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, Boolean isTeacher, + Boolean prefix) throws UserInfoValidationException { Organisation org; User user = userMap.getUser(); ExtCourseClassMap extCourseClassMap = getExtCourseClassMap(extServer.getSid(), extCourseId); if (extCourseClassMap == null) { //create new ExtCourseClassMap - - org = createOrganisation(extServer, user, extCourseId, extCourseName, countryIsoCode, langIsoCode, - parentOrgId, prefix); - extCourseClassMap = new ExtCourseClassMap(); - extCourseClassMap.setCourseid(extCourseId); - extCourseClassMap.setExtServer(extServer); - extCourseClassMap.setOrganisation(org); - service.save(extCourseClassMap); - + extCourseClassMap = createExtCourseClassMap(extServer, user.getUserId(), extCourseId, extCourseName, + countryIsoCode, langIsoCode, parentOrgId, prefix); + org = extCourseClassMap.getOrganisation(); } else { org = extCourseClassMap.getOrganisation(); @@ -202,6 +198,21 @@ return extCourseClassMap; } + @Override + public ExtCourseClassMap createExtCourseClassMap(ExtServer extServer, Integer userId, String extCourseId, + String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, Boolean prefix) + throws UserInfoValidationException { + User user = (User) service.findById(User.class, userId); + Organisation org = createOrganisation(extServer, user, extCourseId, extCourseName, countryIsoCode, langIsoCode, + parentOrgId, prefix); + ExtCourseClassMap extCourseClassMap = new ExtCourseClassMap(); + extCourseClassMap.setCourseid(extCourseId); + extCourseClassMap.setExtServer(extServer); + extCourseClassMap.setOrganisation(org); + service.save(extCourseClassMap); + return extCourseClassMap; + } + private void updateUserRoles(User user, Organisation org, Boolean isTeacher) { //create UserOrganisation if it doesn't exist @@ -231,7 +242,7 @@ @Override public List getExtUserUseridMapByExtServer(ExtServer extServer) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("extServer.sid", extServer.getSid()); List list = service.findByProperties(ExtUserUseridMap.class, properties); return list; @@ -260,7 +271,7 @@ @Override public ExtUserUseridMap getExistingExtUserUseridMap(ExtServer extServer, String extUsername) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("extServer.sid", extServer.getSid()); properties.put("extUsername", extUsername); List list = service.findByProperties(ExtUserUseridMap.class, properties); @@ -340,8 +351,8 @@ } } - private Organisation createOrganisation(ExtServer extServer, User user, String extCourseId, - String extCourseName, String countryIsoCode, String langIsoCode, String parentOrgId, Boolean prefix) + private Organisation createOrganisation(ExtServer extServer, User user, String extCourseId, String extCourseName, + String countryIsoCode, String langIsoCode, String parentOrgId, Boolean prefix) throws UserInfoValidationException { Organisation org = new Organisation(); @@ -361,7 +372,7 @@ org.setLocale(LanguageUtil.getSupportedLocale(langIsoCode, countryIsoCode)); org.setEnableCourseNotifications(true); - + // determine whether org will be a group or subgroup Organisation parent = (Organisation) service.findById(Organisation.class, Integer.valueOf(parentOrgId)); if (parent != null) { @@ -454,8 +465,7 @@ return extUserUseridMap; } - private String[] getUserDataFromExtServer(ExtServer extServer, String extUsername) - throws UserInfoFetchException { + private String[] getUserDataFromExtServer(ExtServer extServer, String extUsername) throws UserInfoFetchException { // the callback url must contain %username%, %timestamp% and %hash% // eg: // "http://test100.ics.mq.edu.au/webapps/lams-plglamscontent-bb_bb60/UserData?uid=%username%&ts=%timestamp%&hash=%hash%"; @@ -521,14 +531,14 @@ @Override public List getAllExtServers() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("serverTypeId", ExtServer.INTEGRATION_SERVER_TYPE); return service.findByProperties(ExtServer.class, properties); } - + @Override public List getAllToolConsumers() { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("serverTypeId", ExtServer.LTI_CONSUMER_SERVER_TYPE); return service.findByProperties(ExtServer.class, properties); } @@ -537,15 +547,15 @@ @SuppressWarnings("unchecked") public List getMappedServers(String toolSig) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("tool.toolSignature", toolSig); return service.findByProperties(ExtServerToolAdapterMap.class, properties); } @Override @SuppressWarnings("unchecked") public ExtServerToolAdapterMap getMappedServer(String serverId, String toolSig) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("tool.toolSignature", toolSig); properties.put("extServer.serverid", serverId); List ret = service.findByProperties(ExtServerToolAdapterMap.class, properties); @@ -578,9 +588,10 @@ @Override public void createExtServerLessonMap(Long lessonId, ExtServer extServer) { - createExtServerLessonMap(lessonId, null, extServer);; + createExtServerLessonMap(lessonId, null, extServer); + ; } - + @Override public void createExtServerLessonMap(Long lessonId, String resourceLinkId, ExtServer extServer) { ExtServerLessonMap map = new ExtServerLessonMap(); @@ -622,20 +633,21 @@ .replaceAll("%lessonid%", lessonId.toString()).replaceAll("%timestamp%", timestamp) .replaceAll("%hash%", hash); log.debug(lessonFinishCallbackUrl); - - // in case of LTI Tool Consumer - create a new thread to report score back to LMS (in order to do this task in parallel not to slow down later work) + + // in case of LTI Tool Consumer - create a new thread to report score back to LMS (in order to do this task in parallel not to slow down later work) } else { - + // calculate lesson's MaxPossibleMark Long lessonMaxPossibleMark = toolService.getLessonMaxPossibleMark(lesson); GradebookUserLesson gradebookUserLesson = gradebookService.getGradebookUserLesson(lessonId, user.getUserId()); Double userTotalMark = (gradebookUserLesson == null) || (gradebookUserLesson.getMark() == null) - ? null : gradebookUserLesson.getMark(); - + ? null + : gradebookUserLesson.getMark(); + final String lessonFinishUrl = server.getLessonFinishUrl(); if (userTotalMark != null && StringUtils.isNotBlank(lessonFinishUrl)) { - + Double score = lessonMaxPossibleMark.equals(0L) ? 0 : userTotalMark / lessonMaxPossibleMark; final String scoreStr = (userTotalMark == null) || lessonMaxPossibleMark.equals(0L) ? "" : score.toString(); @@ -749,7 +761,7 @@ String hash = hash(extServer, hashUsername, timestamp); // set values for the parameters - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put("uid", hashUsername); params.put("ts", timestamp); params.put("hash", hash); @@ -761,7 +773,7 @@ String str = isReader.readLine(); JSONArray jsonGroups = new JSONArray(str); - List extGroups = new ArrayList(); + List extGroups = new ArrayList<>(); for (int i = 0; i < jsonGroups.length(); i++) { JSONObject jsonGroup = jsonGroups.getJSONObject(i); ExtGroupDTO group = new ExtGroupDTO(); @@ -771,7 +783,7 @@ // in case group info is also requested - provide selected groups' ids if (extGroupIds != null && extGroupIds.length > 0) { - ArrayList users = new ArrayList(); + ArrayList users = new ArrayList<>(); JSONArray jsonUsers = jsonGroup.getJSONArray("users"); for (int j = 0; j < jsonUsers.length(); j++) { @@ -819,28 +831,28 @@ return extGroups; } - + @Override @SuppressWarnings("unchecked") public ExtCourseClassMap getExtCourseClassMap(Integer sid, Long lessonId) { Lesson lesson = lessonService.getLesson(lessonId); - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("extServer.sid", sid); properties.put("organisation.organisationId", lesson.getOrganisation().getOrganisationId()); List list = service.findByProperties(ExtCourseClassMap.class, properties); return list == null || list.isEmpty() ? null : list.get(0); } - + @Override public ExtServerLessonMap getLtiConsumerLesson(String serverId, String resourceLinkId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("extServer.serverid", serverId); properties.put("resourceLinkId", resourceLinkId); List list = service.findByProperties(ExtServerLessonMap.class, properties); - + return (list == null || list.isEmpty()) ? null : list.get(0); } - + private ExtServerLessonMap getExtServerLessonMap(Long lessonId) { List list = service.findByProperty(ExtServerLessonMap.class, "lessonId", lessonId); if ((list == null) || (list.size() == 0)) { @@ -851,7 +863,7 @@ } private ExtUserUseridMap getExtUserUseridMapByUserId(ExtServer extServer, Integer userId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("extServer.sid", extServer.getSid()); properties.put("user.userId", userId); List list = service.findByProperties(ExtUserUseridMap.class, properties); @@ -878,17 +890,17 @@ public void setLessonService(ILessonService lessonService) { this.lessonService = lessonService; } - + public ILessonService getLessonService() { return lessonService; } - + public void setGradebookService(IGradebookService gradebookService) { this.gradebookService = gradebookService; } - + public void setToolService(ILamsCoreToolService toolService) { this.toolService = toolService; } - + } \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java =================================================================== diff -u -rc2e7e503113e8f6943f4234a09a3ca1e86e5fd55 -r5bf2d3b201efb46864182d72901e497d0acb253f --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java (.../IUserManagementService.java) (revision c2e7e503113e8f6943f4234a09a3ca1e86e5fd55) +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/IUserManagementService.java (.../IUserManagementService.java) (revision 5bf2d3b201efb46864182d72901e497d0acb253f) @@ -27,6 +27,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.Vector; import org.lamsfoundation.lams.themes.Theme; @@ -216,6 +217,11 @@ List getUserOrganisationRoles(Integer orgId, String login); /** + * Returns mapping org ID -> role IDs + */ + Map> getRolesForUser(Integer userId); + + /** * @param login * @param typeId * @param stateId @@ -308,7 +314,7 @@ */ void setRolesForUserOrganisation(User user, Integer organisationId, List rolesList); - void setRolesForUserOrganisation(Integer userId, Integer organisationId, List rolesList); + void setRolesForUserOrganisation(Integer userId, Integer organisationId, Set roleIDList); /** * Returns list of roles suitable for the given orgType. Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java =================================================================== diff -u -rc2e7e503113e8f6943f4234a09a3ca1e86e5fd55 -r5bf2d3b201efb46864182d72901e497d0acb253f --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision c2e7e503113e8f6943f4234a09a3ca1e86e5fd55) +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/service/UserManagementService.java (.../UserManagementService.java) (revision 5bf2d3b201efb46864182d72901e497d0acb253f) @@ -35,6 +35,7 @@ import java.util.Map; import java.util.Set; import java.util.Vector; +import java.util.stream.Collectors; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; @@ -145,7 +146,7 @@ } if (newGroups != null) { - Set obsoleteGroups = new HashSet(grouping.getGroups()); + Set obsoleteGroups = new HashSet<>(grouping.getGroups()); for (OrganisationGroup newGroup : newGroups) { OrganisationGroup existingGroup = null; // check if group already exists @@ -283,7 +284,7 @@ @Override public boolean isUserInRole(Integer userId, Integer orgId, String roleName) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("userOrganisation.user.userId", userId); properties.put("userOrganisation.organisation.organisationId", orgId); properties.put("role.name", roleName); @@ -295,7 +296,7 @@ @Override public List getOrganisationsByTypeAndStatus(Integer typeId, Integer stateId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("organisationType.organisationTypeId", typeId); properties.put("organisationState.organisationStateId", stateId); return baseDAO.findByProperties(Organisation.class, properties); @@ -316,15 +317,25 @@ @Override public List getUserOrganisationRoles(Integer orgId, String login) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("userOrganisation.organisation.organisationId", orgId); properties.put("userOrganisation.user.login", login); return baseDAO.findByProperties(UserOrganisationRole.class, properties); } @Override + @SuppressWarnings("unchecked") + public Map> getRolesForUser(Integer userId) { + return ((List) findByProperty(UserOrganisation.class, "user.userId", userId)).stream() + .collect(Collectors.toMap(userOrganisation -> userOrganisation.getOrganisation().getOrganisationId(), + userOrganisation -> userOrganisation.getUserOrganisationRoles().stream() + .map(userOrganisationRole -> userOrganisationRole.getRole().getRoleId()) + .collect(Collectors.toSet()))); + } + + @Override public List getUserOrganisationsForUserByTypeAndStatus(String login, Integer typeId, Integer stateId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("user.login", login); properties.put("organisation.organisationType.organisationTypeId", typeId); properties.put("organisation.organisationState.organisationStateId", stateId); @@ -334,7 +345,7 @@ @Override public List getUserOrganisationsForUserByTypeAndStatusAndParent(String login, Integer typeId, Integer stateId, Integer parentOrgId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("user.login", login); properties.put("organisation.organisationType.organisationTypeId", typeId); properties.put("organisation.organisationState.organisationStateId", stateId); @@ -363,7 +374,7 @@ @Override public UserOrganisation getUserOrganisation(Integer userId, Integer orgId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("user.userId", userId); properties.put("organisation.organisationId", orgId); List results = baseDAO.findByProperties(UserOrganisation.class, properties); @@ -394,7 +405,7 @@ workspaceFolder.addChild(workspaceFolder2); save(workspaceFolder); - Set folders = new HashSet(); + Set folders = new HashSet<>(); folders.add(workspaceFolder); folders.add(workspaceFolder2); organisation.setWorkspaceFolders(folders); @@ -504,7 +515,7 @@ String query = "select u.userId,u.login,u.title,u.firstName,u.lastName, r " + "from User u left join u.userOrganisations as uo left join uo.userOrganisationRoles as uor left join uor.role as r where uo.organisation.organisationId=?"; List list = baseDAO.find(query, orgId); - Map beansMap = new HashMap(); + Map beansMap = new HashMap<>(); for (int i = 0; i < list.size(); i++) { Object[] data = (Object[]) list.get(i); if (beansMap.containsKey(data[0])) { @@ -520,7 +531,7 @@ beansMap.put((Integer) data[0], bean); } } - List userManageBeans = new ArrayList(); + List userManageBeans = new ArrayList<>(); userManageBeans.addAll(beansMap.values()); return userManageBeans; } @@ -595,9 +606,10 @@ } @Override - public void setRolesForUserOrganisation(Integer userId, Integer organisationId, List rolesList) { + public void setRolesForUserOrganisation(Integer userId, Integer organisationId, Set roleIDList) { User user = (User) findById(User.class, userId); - setRolesForUserOrganisation(user, organisationId, rolesList); + setRolesForUserOrganisation(user, organisationId, + roleIDList.stream().map(String::valueOf).collect(Collectors.toList())); } @Override @@ -638,11 +650,11 @@ setRolesForUserOrganisation(user, org.getParentOrganisation(), rolesList); } - List rolesCopy = new ArrayList(); + List rolesCopy = new ArrayList<>(); rolesCopy.addAll(rolesList); log.debug("rolesList.size: " + rolesList.size()); Set uors = uo.getUserOrganisationRoles(); - Set uorsCopy = new HashSet(); + Set uorsCopy = new HashSet<>(); if (uors != null) { uorsCopy.addAll(uors); // remove the common part from the rolesList and uors @@ -659,7 +671,7 @@ log.debug("removing roles: " + uorsCopy); uors.removeAll(uorsCopy); } else { - uors = new HashSet(); + uors = new HashSet<>(); } for (String roleId : rolesCopy) { if (roleId == null) { @@ -751,7 +763,7 @@ @Override public List filterRoles(List rolelist, Boolean isSysadmin, OrganisationType orgType) { - List allRoles = new ArrayList(); + List allRoles = new ArrayList<>(); allRoles.addAll(rolelist); Role role = new Role(); if (!orgType.getOrganisationTypeId().equals(OrganisationType.ROOT_TYPE) || !isSysadmin) {