Search in sources :

Example 6 with WsGetAttributeAssignmentsResults

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

the class GroupingAssignmentServiceImpl method setGroupingAttributes.

// sets the attributes of a grouping in grouper or the database to match the attributes of the supplied grouping
public Grouping setGroupingAttributes(Grouping grouping) {
    logger.info("setGroupingAttributes; grouping: " + grouping + ";");
    boolean listservOn = false;
    boolean optInOn = false;
    boolean optOutOn = false;
    WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsForGroup(ASSIGN_TYPE_GROUP, grouping.getPath());
    WsAttributeDefName[] attributeDefNames = wsGetAttributeAssignmentsResults.getWsAttributeDefNames();
    if (attributeDefNames != null && attributeDefNames.length > 0) {
        for (WsAttributeDefName defName : attributeDefNames) {
            String name = defName.getName();
            if (name.equals(LISTSERV)) {
                listservOn = true;
            } else if (name.equals(OPT_IN)) {
                optInOn = true;
            } else if (name.equals(OPT_OUT)) {
                optOutOn = true;
            }
        }
    }
    grouping.setListservOn(listservOn);
    grouping.setOptInOn(optInOn);
    grouping.setOptOutOn(optOutOn);
    return grouping;
}
Also used : WsAttributeDefName(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeDefName) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)

Example 7 with WsGetAttributeAssignmentsResults

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

the class MemberAttributeServiceImpl method getMembershipAttributes.

// checks to see if a membership has an attribute of a specific type and returns the list if it does
public WsAttributeAssign[] getMembershipAttributes(String assignType, String attributeUuid, String membershipID) {
    logger.info("getMembershipAttributes; assignType: " + assignType + "; name: " + attributeUuid + "; membershipID: " + membershipID + ";");
    WsGetAttributeAssignmentsResults attributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsForMembership(assignType, attributeUuid, membershipID);
    WsAttributeAssign[] wsAttributes = attributeAssignmentsResults.getWsAttributeAssigns();
    return wsAttributes != null ? wsAttributes : grouperFS.makeEmptyWsAttributeAssignArray();
}
Also used : WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

Example 8 with WsGetAttributeAssignmentsResults

use of edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults 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)

Example 9 with WsGetAttributeAssignmentsResults

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

the class GrouperFactoryServiceImplLocal method removeGroupsWithoutOptIn.

private WsGetAttributeAssignmentsResults removeGroupsWithoutOptIn(WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults) {
    List<WsGroup> wsGroupList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsGroups());
    List<WsGroup> wsGroupsWithOptIn = new ArrayList<>();
    List<WsAttributeAssign> wsAttributeAssignList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsAttributeAssigns());
    List<WsAttributeAssign> wsAttributeAssignsWithOptIn = new ArrayList<>();
    for (WsGroup wsGroup : wsGroupList) {
        Grouping grouping = groupingRepository.findByPath(wsGroup.getName());
        if (grouping.isOptInOn()) {
            wsGroupsWithOptIn.add(wsGroup);
        }
    }
    for (WsAttributeAssign wsAttributeAssign : wsAttributeAssignList) {
        Grouping grouping = groupingRepository.findByPath(wsAttributeAssign.getOwnerGroupName());
        if (grouping.isOptInOn()) {
            wsAttributeAssignsWithOptIn.add(wsAttributeAssign);
        }
    }
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(wsAttributeAssignsWithOptIn.toArray(new WsAttributeAssign[wsAttributeAssignsWithOptIn.size()]));
    wsGetAttributeAssignmentsResults.setWsGroups(wsGroupsWithOptIn.toArray(new WsGroup[wsGroupsWithOptIn.size()]));
    return wsGetAttributeAssignmentsResults;
}
Also used : ArrayList(java.util.ArrayList) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Grouping(edu.hawaii.its.api.type.Grouping)

Example 10 with WsGetAttributeAssignmentsResults

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

the class GrouperFactoryServiceImplLocal method makeWsGetAttributeAssignmentsResultsTrio.

@Override
public WsGetAttributeAssignmentsResults makeWsGetAttributeAssignmentsResultsTrio(String assignType, String attributeDefNameName0, String attributeDefNameName1) {
    WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults = makeWsGetAttributeAssignmentsResultsTrio(assignType, attributeDefNameName0);
    List<WsAttributeAssign> attributeAssigns = new ArrayList<>();
    attributeAssigns.addAll(Arrays.asList(wsGetAttributeAssignmentsResults.getWsAttributeAssigns()));
    attributeAssigns.addAll(attributeAssignsOptIn());
    attributeAssigns.addAll(attributeAssignsOptOut());
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(attributeAssigns.toArray(new WsAttributeAssign[attributeAssigns.size()]));
    if (attributeDefNameName1.equals(OPT_IN)) {
        wsGetAttributeAssignmentsResults = removeGroupsWithoutOptIn(wsGetAttributeAssignmentsResults);
    } else if (attributeDefNameName1.equals(OPT_OUT)) {
        wsGetAttributeAssignmentsResults = removeGroupsWithoutOptOut(wsGetAttributeAssignmentsResults);
    }
    return wsGetAttributeAssignmentsResults;
}
Also used : ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

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