Search in sources :

Example 6 with WsAttributeAssign

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

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

Example 8 with WsAttributeAssign

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

the class GrouperFactoryServiceImplLocal method addAssignmentResults.

private WsGetAttributeAssignmentsResults addAssignmentResults(WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults, String attributeName) {
    List<WsAttributeDefName> wsAttributeDefNames = new ArrayList<>();
    List<WsAttributeAssign> wsAttributeAssigns = new ArrayList<>();
    if (wsGetAttributeAssignmentsResults.getWsAttributeAssigns() != null) {
        Collections.addAll(wsAttributeAssigns, wsGetAttributeAssignmentsResults.getWsAttributeAssigns());
    }
    if (wsGetAttributeAssignmentsResults.getWsAttributeDefNames() != null) {
        Collections.addAll(wsAttributeDefNames, wsGetAttributeAssignmentsResults.getWsAttributeDefNames());
    }
    WsAttributeAssign wsAttributeAssign = new WsAttributeAssign();
    WsAttributeDefName wsAttributeDefName = new WsAttributeDefName();
    wsAttributeDefName.setName(attributeName);
    wsAttributeAssign.setAttributeDefNameName(attributeName);
    wsAttributeAssigns.add(wsAttributeAssign);
    wsAttributeDefNames.add(wsAttributeDefName);
    wsGetAttributeAssignmentsResults.setWsAttributeDefNames(wsAttributeDefNames.toArray(new WsAttributeDefName[wsAttributeDefNames.size()]));
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(wsAttributeAssigns.toArray(new WsAttributeAssign[wsAttributeAssigns.size()]));
    return wsGetAttributeAssignmentsResults;
}
Also used : WsAttributeDefName(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeDefName) ArrayList(java.util.ArrayList) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

Example 9 with WsAttributeAssign

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

the class GrouperFactoryServiceImplLocal method removeGroupsWithoutOptOut.

private WsGetAttributeAssignmentsResults removeGroupsWithoutOptOut(WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults) {
    List<WsGroup> wsGroupList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsGroups());
    List<WsAttributeAssign> wsAttributeAssignList = Arrays.asList(wsGetAttributeAssignmentsResults.getWsAttributeAssigns());
    List<WsGroup> newWsGroupList = new ArrayList<>();
    List<WsAttributeAssign> newWsAttributeAssignList = new ArrayList<>();
    for (WsGroup wsGroup : wsGroupList) {
        Grouping grouping = groupingRepository.findByPath(wsGroup.getName());
        if (grouping.isOptOutOn()) {
            newWsGroupList.add(wsGroup);
        }
    }
    for (WsAttributeAssign wsAttributeAssign : wsAttributeAssignList) {
        Grouping grouping = groupingRepository.findByPath(wsAttributeAssign.getOwnerGroupName());
        if (grouping.isOptOutOn()) {
            newWsAttributeAssignList.add(wsAttributeAssign);
        }
    }
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(newWsAttributeAssignList.toArray(new WsAttributeAssign[newWsAttributeAssignList.size()]));
    wsGetAttributeAssignmentsResults.setWsGroups(newWsGroupList.toArray(new WsGroup[newWsGroupList.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 WsAttributeAssign

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

the class GrouperFactoryServiceImplLocal method makeWsGetAttributeAssignmentsResultsForMembership.

@Override
public WsGetAttributeAssignmentsResults makeWsGetAttributeAssignmentsResultsForMembership(String assignType, String attributeDefNameName, String membershipId) {
    Membership membership = membershipRepository.findById(membershipId);
    WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults = new WsGetAttributeAssignmentsResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(SUCCESS);
    WsAttributeAssign[] wsAttributeAssigns = new WsAttributeAssign[1];
    WsAttributeAssign wsAttributeAssign = new WsAttributeAssign();
    if (membership.isSelfOpted()) {
        wsAttributeAssign.setAttributeDefNameName(SELF_OPTED);
    }
    wsAttributeAssigns[0] = wsAttributeAssign;
    wsGetAttributeAssignmentsResults.setResultMetadata(wsResultMeta);
    wsGetAttributeAssignmentsResults.setWsAttributeAssigns(wsAttributeAssigns);
    return wsGetAttributeAssignmentsResults;
}
Also used : Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)

Aggregations

WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)11 ArrayList (java.util.ArrayList)8 Grouping (edu.hawaii.its.api.type.Grouping)5 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)5 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)3 WsAttributeDefName (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeDefName)2 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)1 Group (edu.hawaii.its.api.type.Group)1 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 GcGetAttributeAssignments (edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments)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 WsGetMembershipsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)1 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)1 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)1 WsStemLookup (edu.internet2.middleware.grouperClient.ws.beans.WsStemLookup)1