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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations