Search in sources :

Example 1 with KimTypeInfoService

use of org.kuali.kfs.kim.api.type.KimTypeInfoService in project cu-kfs by CU-CommunityApps.

the class RoleServiceBase method getAttributeNameToAttributeIdMappings.

/*
     * CU Customization: Create mappings from attribute names to attribute IDs.
     */
protected Map<String, String> getAttributeNameToAttributeIdMappings(Collection<String> roleIds, Map<String, String> qualification) {
    if (CollectionUtils.isEmpty(roleIds) || qualification == null || qualification.isEmpty()) {
        return Collections.emptyMap();
    }
    KimTypeInfoService typeInfoService = getKimTypeInfoService();
    Set<String> attributeNames = qualification.keySet();
    Map<String, String> validAttributeIds = new HashMap<>();
    roleIds.stream().map(this::getRoleLite).filter(ObjectUtils::isNotNull).map(RoleLite::getKimTypeId).distinct().map(typeInfoService::getKimType).filter(ObjectUtils::isNotNull).flatMap(kimType -> kimType.getAttributeDefinitions().stream()).map(KimTypeAttribute::getKimAttribute).filter(attribute -> ObjectUtils.isNotNull(attribute) && attributeNames.contains(attribute.getAttributeName())).forEach(attribute -> validAttributeIds.put(attribute.getAttributeName(), attribute.getId()));
    for (String attributeName : attributeNames) {
        validAttributeIds.computeIfAbsent(attributeName, this::getAttributeIdByName);
    }
    return validAttributeIds;
}
Also used : KimApiServiceLocator(org.kuali.kfs.kim.api.services.KimApiServiceLocator) KimAttribute(org.kuali.kfs.kim.impl.common.attribute.KimAttribute) KimTypeAttribute(org.kuali.kfs.kim.impl.type.KimTypeAttribute) KimTypeInfoService(org.kuali.kfs.kim.api.type.KimTypeInfoService) HashMap(java.util.HashMap) DelegationType(org.kuali.kfs.core.api.delegation.DelegationType) StringUtils(org.apache.commons.lang3.StringUtils) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) DelegateType(org.kuali.kfs.kim.impl.common.delegate.DelegateType) ResponsibilityInternalService(org.kuali.kfs.kim.impl.responsibility.ResponsibilityInternalService) KimType(org.kuali.kfs.kim.impl.type.KimType) Map(java.util.Map) LookupService(org.kuali.kfs.krad.service.LookupService) GroupService(org.kuali.kfs.kim.api.group.GroupService) MemberType(org.kuali.kfs.core.api.membership.MemberType) Group(org.kuali.kfs.kim.impl.group.Group) DelegateMember(org.kuali.kfs.kim.impl.common.delegate.DelegateMember) KRADServiceLocatorWeb(org.kuali.kfs.krad.service.KRADServiceLocatorWeb) Collection(java.util.Collection) KimConstants(org.kuali.kfs.kim.api.KimConstants) KRADServiceLocator(org.kuali.kfs.krad.service.KRADServiceLocator) Set(java.util.Set) KimImplServiceLocator(org.kuali.kfs.kim.impl.services.KimImplServiceLocator) KRADPropertyConstants(org.kuali.kfs.krad.util.KRADPropertyConstants) ObjectUtils(org.kuali.kfs.krad.util.ObjectUtils) IdentityService(org.kuali.kfs.kim.api.identity.IdentityService) List(java.util.List) Logger(org.apache.logging.log4j.Logger) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService) Principal(org.kuali.kfs.kim.impl.identity.principal.Principal) RoleContract(org.kuali.kfs.kim.api.role.RoleContract) RoleTypeService(org.kuali.kfs.kim.framework.role.RoleTypeService) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) CriteriaLookupService(org.kuali.kfs.core.api.criteria.CriteriaLookupService) KimTypeAttribute(org.kuali.kfs.kim.impl.type.KimTypeAttribute) HashMap(java.util.HashMap) KimTypeInfoService(org.kuali.kfs.kim.api.type.KimTypeInfoService) ObjectUtils(org.kuali.kfs.krad.util.ObjectUtils)

Aggregations

ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 CollectionUtils (org.apache.commons.collections4.CollectionUtils)1 StringUtils (org.apache.commons.lang3.StringUtils)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 CriteriaLookupService (org.kuali.kfs.core.api.criteria.CriteriaLookupService)1 DelegationType (org.kuali.kfs.core.api.delegation.DelegationType)1 MemberType (org.kuali.kfs.core.api.membership.MemberType)1 KimConstants (org.kuali.kfs.kim.api.KimConstants)1 GroupService (org.kuali.kfs.kim.api.group.GroupService)1 IdentityService (org.kuali.kfs.kim.api.identity.IdentityService)1 RoleContract (org.kuali.kfs.kim.api.role.RoleContract)1 KimApiServiceLocator (org.kuali.kfs.kim.api.services.KimApiServiceLocator)1 KimTypeInfoService (org.kuali.kfs.kim.api.type.KimTypeInfoService)1