public List<String> getDepartmentsForPrincipalInRoles( String principalId, List<String> roleIds, DateTime asOfDate, boolean isActiveOnly) { Set<String> departments = new HashSet<String>(); Map<String, String> qualifiers = new HashMap<String, String>(); qualifiers.put(KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName(), "%"); qualifiers.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), "%"); qualifiers.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), "%"); qualifiers.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), "%"); List<Map<String, String>> roleQualifiers = getRoleQualifiers(principalId, roleIds, qualifiers, asOfDate, isActiveOnly); for (Map<String, String> roleQualifier : roleQualifiers) { String department = MapUtils.getString( roleQualifier, KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName()); String groupKeyCode = MapUtils.getString( roleQualifier, KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName()); if (department != null && groupKeyCode != null) { departments.add(groupKeyCode + "|" + department); } } List<String> locations = getLocationsForPrincipalInRoles(principalId, roleIds, asOfDate, isActiveOnly); departments.addAll( getDepartmentService().getDepartmentValuesWithLocations(locations, asOfDate.toLocalDate())); return new ArrayList<String>(departments); }
public List<RoleMember> getRoleMembersInLocation( String namespaceCode, String roleName, String location, DateTime asOfDate, boolean isActiveOnly) { Map<String, String> qualification = new HashMap<String, String>(); qualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); return getRoleMembers(namespaceCode, roleName, qualification, asOfDate, isActiveOnly); }
public boolean principalHasRoleInLocation( String principalId, String namespaceCode, String roleName, String location, DateTime asOfDate) { Map<String, String> qualification = new HashMap<String, String>(); qualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); return principalHasRole(principalId, namespaceCode, roleName, qualification, asOfDate); }
public List<String> getLocationsForPrincipalInRoles( String principalId, List<String> roleIds, DateTime asOfDate, boolean isActiveOnly) { Set<String> locations = new HashSet<String>(); Map<String, String> qualifiers = new HashMap<String, String>(); qualifiers.put(KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName(), "%"); qualifiers.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), "%"); qualifiers.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), "%"); qualifiers.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), "%"); List<Map<String, String>> roleQualifiers = getRoleQualifiers(principalId, roleIds, qualifiers, asOfDate, isActiveOnly); for (Map<String, String> roleQualifier : roleQualifiers) { String location = MapUtils.getString( roleQualifier, KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName()); if (location != null) { locations.add(location); } } return new ArrayList<String>(locations); }