Search in sources :

Example 1 with GcGetAttributeAssignments

use of edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments in project uhgroupings by uhawaii-system-its-ti-iam.

the class TestGroupingAssignmentService method grouperTest.

@Test
public void grouperTest() {
    List<String> groupPaths = groupingAssignmentService.getGroupPaths(username[0]);
    List<String> groupings = new ArrayList<>();
    List<String> groupings2 = new ArrayList<>();
    if (groupPaths.size() > 0) {
        List<WsAttributeAssign> attributes = new ArrayList<>();
        for (String path : groupPaths) {
            WsGetAttributeAssignmentsResults trioGroups = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP).addOwnerGroupName(path).execute();
            if (trioGroups.getWsAttributeAssigns() != null) {
                Collections.addAll(attributes, trioGroups.getWsAttributeAssigns());
            }
        }
        if (attributes.size() > 0) {
            groupings.addAll(attributes.stream().map(WsAttributeAssign::getOwnerGroupName).collect(Collectors.toList()));
        }
        assertNotNull(groupings);
        // ////////////////////////////////////////////////////////////////////////////////
        GcGetAttributeAssignments trioGroups2 = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP);
        groupPaths.forEach(trioGroups2::addOwnerGroupName);
        WsGetAttributeAssignmentsResults attributeAssignmentsResults2 = trioGroups2.execute();
        assertNotNull(attributeAssignmentsResults2);
        WsAttributeAssign[] wsGroups2 = attributeAssignmentsResults2.getWsAttributeAssigns();
        if (wsGroups2 != null && wsGroups2.length > 0) {
            for (WsAttributeAssign grouping : wsGroups2) {
                groupings2.add(grouping.getOwnerGroupName());
            }
        }
    }
    assertNotNull(groupings2);
}
Also used : GcGetAttributeAssignments(edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments) ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with GcGetAttributeAssignments

use of edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImpl method makeWsGetAttributeAssignmentsResultsTrio.

@Override
public List<WsGetAttributeAssignmentsResults> makeWsGetAttributeAssignmentsResultsTrio(String assignType, String attributeDefNameName, List<String> ownerGroupNames) {
    List<WsGetAttributeAssignmentsResults> attributeAssignmentsResultList = new ArrayList<>();
    Iterator iterator = ownerGroupNames.iterator();
    for (int i = 0; i < ownerGroupNames.size(); i += ATTRIBUTES_ASSIGN_ID_SIZE) {
        GcGetAttributeAssignments attributeAssignments = new GcGetAttributeAssignments().addAttributeDefNameName(attributeDefNameName).assignAttributeAssignType(assignType);
        for (int j = 0; j < ATTRIBUTES_ASSIGN_ID_SIZE; j++) {
            if (iterator.hasNext()) {
                attributeAssignments.addOwnerGroupName(iterator.next().toString());
            } else {
                break;
            }
        }
        attributeAssignmentsResultList.add(attributeAssignments.execute());
    }
    return attributeAssignmentsResultList;
}
Also used : GcGetAttributeAssignments(edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)

Aggregations

GcGetAttributeAssignments (edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments)2 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)2 ArrayList (java.util.ArrayList)2 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)1 Iterator (java.util.Iterator)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1