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