Search in sources :

Example 6 with DelegateMember

use of org.kuali.kfs.kim.impl.common.delegate.DelegateMember in project cu-kfs by CU-CommunityApps.

the class PersonImpl method populateDelegateMembers.

private void populateDelegateMembers() {
    Map<String, String> criteria = new HashMap<>(2);
    criteria.put(KIMPropertyConstants.DelegationMember.MEMBER_ID, principalId);
    criteria.put(KIMPropertyConstants.DelegationMember.MEMBER_TYPE_CODE, MemberType.PRINCIPAL.getCode());
    delegateMembers = (List<DelegateMember>) getBusinessObjectService().findMatching(DelegateMember.class, criteria);
    criteria.clear();
    for (DelegateMember dmb : delegateMembers) {
        criteria.put(KIMPropertyConstants.Delegation.DELEGATION_ID, dmb.getDelegationId());
        DelegateType delegate = getBusinessObjectService().findByPrimaryKey(DelegateType.class, criteria);
        dmb.setDelegationType(delegate.getDelegationTypeCode());
    }
}
Also used : HashMap(java.util.HashMap) DelegateMember(org.kuali.kfs.kim.impl.common.delegate.DelegateMember) DelegateType(org.kuali.kfs.kim.impl.common.delegate.DelegateType)

Example 7 with DelegateMember

use of org.kuali.kfs.kim.impl.common.delegate.DelegateMember 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

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