Search in sources :

Example 11 with KimType

use of org.kuali.kfs.kim.impl.type.KimType in project cu-kfs by CU-CommunityApps.

the class RoleServiceImpl method getDelegationTypeService.

protected DelegationTypeService getDelegationTypeService(String delegationId) {
    DelegationTypeService service = null;
    DelegateType delegateType = getKimDelegationImpl(delegationId);
    KimType kimType = KimApiServiceLocator.getKimTypeInfoService().getKimType(delegateType.getKimTypeId());
    if (kimType != null) {
        KimTypeService tempService = KimFrameworkServiceLocator.getKimTypeService(kimType);
        if (tempService instanceof DelegationTypeService) {
            service = (DelegationTypeService) tempService;
        } else {
            LOG.error("Service returned for type " + kimType + "(" + kimType.getName() + ") was not a DelegationTypeService.  Was a " + (tempService != null ? tempService.getClass() : "(null)"));
        }
    } else {
        // delegateType has no type - default to role type if possible
        RoleTypeService roleTypeService = getRoleTypeService(delegateType.getRoleId());
        if (roleTypeService instanceof DelegationTypeService) {
            service = (DelegationTypeService) roleTypeService;
        }
    }
    return service;
}
Also used : KimType(org.kuali.kfs.kim.impl.type.KimType) RoleTypeService(org.kuali.kfs.kim.framework.role.RoleTypeService) KimTypeService(org.kuali.kfs.kim.framework.type.KimTypeService) DelegationTypeService(org.kuali.kfs.kim.framework.common.delegate.DelegationTypeService) DelegateType(org.kuali.kfs.kim.impl.common.delegate.DelegateType)

Example 12 with KimType

use of org.kuali.kfs.kim.impl.type.KimType in project cu-kfs by CU-CommunityApps.

the class SecurityProvisioningGroupRule method validateSecurityProvisioningGroup.

@SuppressWarnings("deprecation")
private boolean validateSecurityProvisioningGroup(MaintenanceDocument document, SecurityProvisioningGroup securityProvisioningGroup, int index) {
    boolean success = true;
    RoleLite role = StringUtils.isBlank(securityProvisioningGroup.getRoleId()) ? null : getRoleService().getRoleWithoutMembers(securityProvisioningGroup.getRoleId());
    if (role != null) {
        KimType kimType = getKimTypeInfoService().getKimType(role.getKimTypeId());
        KimTypeService kimTypeService = getKimTypeService(kimType);
        if (kimTypeService != null && kimTypeService instanceof org.kuali.kfs.kns.kim.role.DerivedRoleTypeServiceBase) {
            success = false;
            String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ROLE_NAME : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ROLE_NAME);
            GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_ROLE_DERIVED, getRoleNameForErrorMessage(securityProvisioningGroup.getRole()));
        }
    }
    if (success) {
        // check second against last.
        if (StringUtils.isNotBlank(securityProvisioningGroup.getDistributedAuthorizerRoleId())) {
            if (StringUtils.isNotBlank(securityProvisioningGroup.getAdditionalAuthorizerRoleId())) {
                if (securityProvisioningGroup.getDistributedAuthorizerRoleId().equals(securityProvisioningGroup.getAdditionalAuthorizerRoleId())) {
                    success = false;
                    String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_ROLE_ID);
                    GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_AUTH_UNIQUE, new String[] { KSRConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_DIST_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_LBL });
                }
            }
            if (StringUtils.isNotBlank(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                if (securityProvisioningGroup.getDistributedAuthorizerRoleId().equals(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                    success = false;
                    String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID);
                    GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_AUTH_UNIQUE, new String[] { KSRConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_DIST_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_LBL });
                }
            }
        }
        if (StringUtils.isNotBlank(securityProvisioningGroup.getAdditionalAuthorizerRoleId())) {
            if (StringUtils.isNotBlank(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                if (securityProvisioningGroup.getAdditionalAuthorizerRoleId().equals(securityProvisioningGroup.getCentralAuthorizerRoleId())) {
                    success = false;
                    String errorPath = (index < 0) ? KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_ROLE_ID);
                    GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_AUTH_UNIQUE, new String[] { KSRConstants.SECURITY_PROVISIONING_GROUP_CENT_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_DIST_AUTH_LBL, KSRConstants.SECURITY_PROVISIONING_GROUP_ADD_AUTH_LBL });
                }
            }
        }
    }
    SecurityProvisioning securityProvisioning = (SecurityProvisioning) document.getDocumentDataObject();
    List<SecurityProvisioningGroup> securityProvisioningGroupList = securityProvisioning.getSecurityProvisioningGroups();
    for (int i = 0; i < securityProvisioningGroupList.size(); i++) {
        if (i == index) {
            continue;
        }
        if (securityProvisioningGroup.getTabId() == null) {
            break;
        }
        if (securityProvisioningGroup.getTabId().equals(securityProvisioningGroupList.get(i).getTabId())) {
            if (securityProvisioningGroup.getRoleTabOrder() != null && securityProvisioningGroup.getRoleTabOrder().equals(securityProvisioningGroupList.get(i).getRoleTabOrder())) {
                success = false;
                String errorPath = (index < 0) ? KSRPropertyConstants.PROVISIONING_ROLE_TAB_ORDER : buildPropertyPath(buildIndexedProperty(KSRConstants.SECURITY_PROVISIONING_GROUPS, index), KSRPropertyConstants.PROVISIONING_ROLE_TAB_ORDER);
                GlobalVariables.getMessageMap().putError(errorPath, KSRKeyConstants.ERROR_SECURITY_PROVISIONING_GROUP_TAB_ORDER_UNIQUE, getRoleNameForErrorMessage(securityProvisioningGroup.getRole()));
            }
        }
    }
    return success;
}
Also used : KimType(org.kuali.kfs.kim.impl.type.KimType) SecurityProvisioning(edu.cornell.kfs.ksr.businessobject.SecurityProvisioning) SecurityProvisioningGroup(edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup) KimTypeService(org.kuali.kfs.kim.framework.type.KimTypeService) RoleLite(org.kuali.kfs.kim.impl.role.RoleLite)

Example 13 with KimType

use of org.kuali.kfs.kim.impl.type.KimType in project cu-kfs by CU-CommunityApps.

the class OrgReviewRole method getAttributeSetAsQualifierList.

public List<KfsKimDocumentAttributeData> getAttributeSetAsQualifierList(Map<String, String> qualifiers) {
    KimType kimTypeInfo = KimApiServiceLocator.getKimTypeInfoService().getKimType(kimTypeId);
    List<KfsKimDocumentAttributeData> attributesList = new ArrayList<>();
    KfsKimDocumentAttributeData attribData;
    if (LOG.isDebugEnabled()) {
        LOG.debug("passed qualifiers: " + StringUtils.join(qualifiers.keySet(), ", "));
    }
    for (String key : qualifiers.keySet()) {
        KimTypeAttribute attribInfo = kimTypeInfo.getAttributeDefinitionByName(key);
        if (attribInfo == null) {
            LOG.debug("attribute info for qualifier " + key + " is null");
        }
        attribData = new KfsKimDocumentAttributeData();
        attribData.setKimAttribute(attribInfo.getKimAttribute());
        attribData.setKimTypId(kimTypeInfo.getId());
        attribData.setKimAttrDefnId(attribInfo.getId());
        // attribData.setAttrDataId(attrDataId) - Not Available
        attribData.setAttrVal(qualifiers.get(key));
        attributesList.add(attribData);
    }
    return attributesList;
}
Also used : KimType(org.kuali.kfs.kim.impl.type.KimType) KimTypeAttribute(org.kuali.kfs.kim.impl.type.KimTypeAttribute) ArrayList(java.util.ArrayList)

Aggregations

KimType (org.kuali.kfs.kim.impl.type.KimType)13 KimTypeAttribute (org.kuali.kfs.kim.impl.type.KimTypeAttribute)7 ArrayList (java.util.ArrayList)3 SecurityRequestRoleQualification (edu.cornell.kfs.ksr.businessobject.SecurityRequestRoleQualification)2 SecurityRequestRoleQualificationDetail (edu.cornell.kfs.ksr.businessobject.SecurityRequestRoleQualificationDetail)2 HashMap (java.util.HashMap)2 RoleTypeService (org.kuali.kfs.kim.framework.role.RoleTypeService)2 KimTypeService (org.kuali.kfs.kim.framework.type.KimTypeService)2 KimAttribute (org.kuali.kfs.kim.impl.common.attribute.KimAttribute)2 DelegateType (org.kuali.kfs.kim.impl.common.delegate.DelegateType)2 SecurityProvisioning (edu.cornell.kfs.ksr.businessobject.SecurityProvisioning)1 SecurityProvisioningGroup (edu.cornell.kfs.ksr.businessobject.SecurityProvisioningGroup)1 SecurityRequestRole (edu.cornell.kfs.ksr.businessobject.SecurityRequestRole)1 SecurityRequestDocument (edu.cornell.kfs.ksr.document.SecurityRequestDocument)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Stream (java.util.stream.Stream)1