Search in sources :

Example 16 with WsGetAttributeAssignmentsResults

use of edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults in project uhgroupings by uhawaii-system-its-ti-iam.

the class GroupingAssignmentServiceImpl method groupingsOpted.

// returns a list of groupings corresponding to the include group orr exclude group (includeOrrExclude) in groupPaths that
// have the self-opted attribute set in the membership
public List<Grouping> groupingsOpted(String includeOrrExclude, String username, List<String> groupPaths) {
    logger.info("groupingsOpted; includeOrrExclude: " + includeOrrExclude + "; username: " + username + ";");
    List<String> groupingsOpted = new ArrayList<>();
    List<String> groupsOpted = groupPaths.stream().filter(group -> group.endsWith(includeOrrExclude) && memberAttributeService.isSelfOpted(group, username)).map(helperService::parentGroupingPath).collect(Collectors.toList());
    if (groupsOpted.size() > 0) {
        List<WsGetAttributeAssignmentsResults> attributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsTrio(ASSIGN_TYPE_GROUP, TRIO, groupsOpted);
        List<WsGroup> triosList = new ArrayList<>();
        for (WsGetAttributeAssignmentsResults results : attributeAssignmentsResults) {
            triosList.addAll(Arrays.asList(results.getWsGroups()));
        }
        groupingsOpted.addAll(triosList.stream().map(WsGroup::getName).collect(Collectors.toList()));
    }
    return helperService.makeGroupings(groupingsOpted);
}
Also used : ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup)

Aggregations

WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)13 ArrayList (java.util.ArrayList)10 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)8 Grouping (edu.hawaii.its.api.type.Grouping)5 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)5 WsAttributeDefName (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeDefName)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)2 Group (edu.hawaii.its.api.type.Group)2 GroupingsServiceResult (edu.hawaii.its.api.type.GroupingsServiceResult)2 GcGetAttributeAssignments (edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments)2 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 StemScope (edu.internet2.middleware.grouperClient.ws.StemScope)1 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)1 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)1 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)1 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)1