use of edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GrouperFactoryServiceImplLocal method makeWsGetAttributeAssignmentsResultsForGroup.
@Override
public WsGetAttributeAssignmentsResults makeWsGetAttributeAssignmentsResultsForGroup(String assignType, String group) {
WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults = new WsGetAttributeAssignmentsResults();
Grouping grouping = groupingRepository.findByPath(group);
if (grouping.isListservOn()) {
wsGetAttributeAssignmentsResults = addAssignmentResults(wsGetAttributeAssignmentsResults, LISTSERV);
}
if (grouping.isOptInOn()) {
wsGetAttributeAssignmentsResults = addAssignmentResults(wsGetAttributeAssignmentsResults, OPT_IN);
}
if (grouping.isOptOutOn()) {
wsGetAttributeAssignmentsResults = addAssignmentResults(wsGetAttributeAssignmentsResults, OPT_OUT);
}
return wsGetAttributeAssignmentsResults;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults 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.WsGetAttributeAssignmentsResults 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.WsGetAttributeAssignmentsResults 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;
}
use of edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults in project uhgroupings by uhawaii-system-its-ti-iam.
the class GroupingAssignmentServiceImpl method groupingsToOptInto.
// returns the list of groupings that the user is allowed to opt-in to
public List<Grouping> groupingsToOptInto(String optInUsername, List<String> groupPaths) {
logger.info("groupingsToOptInto; username: " + optInUsername + "; groupPaths : " + groupPaths + ";");
List<String> trios = new ArrayList<>();
List<String> opts = new ArrayList<>();
List<String> excludes = groupPaths.stream().map(group -> group + EXCLUDE).collect(Collectors.toList());
WsGetAttributeAssignmentsResults assignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsTrio(ASSIGN_TYPE_GROUP, TRIO, OPT_IN);
if (assignmentsResults.getWsAttributeAssigns() != null) {
for (WsAttributeAssign assign : assignmentsResults.getWsAttributeAssigns()) {
if (assign.getAttributeDefNameName() != null) {
if (assign.getAttributeDefNameName().equals(TRIO)) {
trios.add(assign.getOwnerGroupName());
} else if (assign.getAttributeDefNameName().equals(OPT_IN)) {
opts.add(assign.getOwnerGroupName());
}
}
}
// opts intersection trios
opts.retainAll(trios);
// excludes intersection opts
excludes.retainAll(opts);
// opts - (opts intersection groupPaths)
opts.removeAll(groupPaths);
// opts union excludes
opts.addAll(excludes);
}
// get rid of duplicates
List<String> groups = new ArrayList<>(new HashSet<>(opts));
return helperService.makeGroupings(groups);
}
Aggregations