Search in sources :

Example 11 with DelegateType

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;
}
Also used : DelegateType(org.kuali.kfs.kim.impl.common.delegate.DelegateType)

Example 12 with DelegateType

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);
}
Also used : DelegateType(org.kuali.kfs.kim.impl.common.delegate.DelegateType)

Example 13 with DelegateType

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);
        }
    }
}
Also used : DelegateMember(org.kuali.kfs.kim.impl.common.delegate.DelegateMember) ArrayList(java.util.ArrayList) RoleMembership(org.kuali.kfs.kim.api.role.RoleMembership) DelegateType(org.kuali.kfs.kim.impl.common.delegate.DelegateType)

Aggregations

DelegateType (org.kuali.kfs.kim.impl.common.delegate.DelegateType)13 DelegateMember (org.kuali.kfs.kim.impl.common.delegate.DelegateMember)7 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 RoleTypeService (org.kuali.kfs.kim.framework.role.RoleTypeService)4 RoleMembership (org.kuali.kfs.kim.api.role.RoleMembership)3 DelegationTypeService (org.kuali.kfs.kim.framework.common.delegate.DelegationTypeService)3 List (java.util.List)2 KfsKimDocDelegateMember (org.kuali.kfs.coa.identity.KfsKimDocDelegateMember)2 OrgReviewRoleService (org.kuali.kfs.coa.service.OrgReviewRoleService)2 RoleService (org.kuali.kfs.kim.api.role.RoleService)2 DelegateMemberAttributeData (org.kuali.kfs.kim.impl.common.delegate.DelegateMemberAttributeData)2 CacheEvict (org.springframework.cache.annotation.CacheEvict)2 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)2 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 DelegationType (org.kuali.kfs.core.api.delegation.DelegationType)1 KimTypeService (org.kuali.kfs.kim.framework.type.KimTypeService)1