use of org.kuali.kfs.kim.impl.common.delegate.DelegateType in project cu-kfs by CU-CommunityApps.
the class RoleServiceBase method getPrimaryDelegation.
protected DelegateType getPrimaryDelegation(String roleId, List<DelegateType> roleDelegates) {
DelegateType primaryDelegate = null;
RoleLite roleLite = getRoleLite(roleId);
for (DelegateType delegate : roleDelegates) {
if (isDelegationPrimary(delegate.getDelegationType())) {
primaryDelegate = delegate;
}
}
if (primaryDelegate == null) {
primaryDelegate = new DelegateType();
primaryDelegate.setRoleId(roleId);
primaryDelegate.setDelegationType(DelegationType.PRIMARY);
primaryDelegate.setKimTypeId(roleLite.getKimTypeId());
}
return primaryDelegate;
}
use of org.kuali.kfs.kim.impl.common.delegate.DelegateType in project cu-kfs by CU-CommunityApps.
the class RoleServiceImpl method linkDelegateToRoleMembership.
protected void linkDelegateToRoleMembership(DelegateType delegation, DelegateMember delegateMember, RoleMembership.Builder roleMembershipBuilder) {
DelegateType delegateType = null;
for (DelegateType existingDelegateType : roleMembershipBuilder.getDelegates()) {
if (existingDelegateType.getDelegationId().equals(delegation.getDelegationId())) {
delegateType = existingDelegateType;
}
}
if (delegateType == null) {
delegateType = new DelegateType();
delegateType.setDelegationType(delegation.getDelegationType());
delegateType.setDelegationId(delegation.getDelegationId());
delegateType.setRoleId(delegation.getRoleId());
delegateType.setActive(delegation.getActive());
delegateType.setKimTypeId(delegation.getKimTypeId());
delegateType.setDelegationTypeCode(delegation.getDelegationTypeCode());
delegateType.setDelegationMembers(new ArrayList<>());
roleMembershipBuilder.getDelegates().add(delegateType);
}
delegateType.getMembers().add(delegateMember);
}
use of org.kuali.kfs.kim.impl.common.delegate.DelegateType in project cu-kfs by CU-CommunityApps.
the class RoleServiceImpl method resolveDelegationMemberRoles.
/**
* Once the delegations for a RoleMembershipInfo object have been determined, any "role" member types need to be
* resolved into groups and principals so that further KIM requests are not needed.
*/
protected void resolveDelegationMemberRoles(List<RoleMembership.Builder> membershipBuilders, Map<String, String> qualification, Set<String> foundRoleTypeMembers) {
// check delegations assigned to this role
for (RoleMembership.Builder roleMembership : membershipBuilders) {
// this code examines those delegations and obtains the member groups and principals
for (DelegateType delegation : roleMembership.getDelegates()) {
List<DelegateMember> newMembers = new ArrayList<>();
for (DelegateMember member : delegation.getMembers()) {
if (MemberType.ROLE.equals(member.getType())) {
// loop over delegation roles and extract the role IDs where the qualifications match
Collection<RoleMembership> delegateMembers = getRoleMembers(Collections.singletonList(member.getMemberId()), qualification, false, foundRoleTypeMembers);
// loop over the role members and create the needed DelegationMember builders
for (RoleMembership rmi : delegateMembers) {
DelegateMember delegateMember = new DelegateMember();
KimCommonUtilsInternal.copyProperties(delegateMember, member);
delegateMember.setMemberId(rmi.getMemberId());
delegateMember.setType(rmi.getType());
newMembers.add(delegateMember);
}
} else {
newMembers.add(member);
}
}
delegation.setDelegationMembers(newMembers);
}
}
}
Aggregations