Search in sources :

Example 16 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class ModelUtils method determineObjectPolicyConfiguration.

public static <O extends ObjectType> ObjectPolicyConfigurationType determineObjectPolicyConfiguration(Class<O> objectClass, List<String> objectSubtypes, SystemConfigurationType systemConfigurationType) throws ConfigurationException {
    ObjectPolicyConfigurationType applicablePolicyConfigurationType = null;
    for (ObjectPolicyConfigurationType aPolicyConfigurationType : systemConfigurationType.getDefaultObjectPolicyConfiguration()) {
        QName typeQName = aPolicyConfigurationType.getType();
        ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName);
        if (objectType == null) {
            throw new ConfigurationException("Unknown type " + typeQName + " in default object policy definition in system configuration");
        }
        if (objectType.getClassDefinition() == objectClass) {
            String aSubType = aPolicyConfigurationType.getSubtype();
            if (aSubType == null) {
                if (applicablePolicyConfigurationType == null) {
                    applicablePolicyConfigurationType = aPolicyConfigurationType;
                }
            } else if (objectSubtypes != null && objectSubtypes.contains(aSubType)) {
                applicablePolicyConfigurationType = aPolicyConfigurationType;
            }
        }
    }
    if (applicablePolicyConfigurationType != null) {
        return applicablePolicyConfigurationType;
    }
    // Deprecated
    for (ObjectPolicyConfigurationType aPolicyConfigurationType : systemConfigurationType.getObjectTemplate()) {
        QName typeQName = aPolicyConfigurationType.getType();
        ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName);
        if (objectType == null) {
            throw new ConfigurationException("Unknown type " + typeQName + " in object template definition in system configuration");
        }
        if (objectType.getClassDefinition() == objectClass) {
            return aPolicyConfigurationType;
        }
    }
    // Deprecated method to specify user template. For compatibility only
    if (objectClass == UserType.class) {
        ObjectReferenceType templateRef = systemConfigurationType.getDefaultUserTemplateRef();
        if (templateRef == null) {
            return null;
        }
        ObjectPolicyConfigurationType policy = new ObjectPolicyConfigurationType();
        policy.setObjectTemplateRef(templateRef.clone());
        return policy;
    }
    return null;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectPolicyConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType) QName(javax.xml.namespace.QName) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

Example 17 with ObjectTypes

use of com.evolveum.midpoint.schema.constants.ObjectTypes in project midpoint by Evolveum.

the class ExpressionHandler method resolveRef.

// Called from the ObjectResolver.resolve
public ObjectType resolveRef(ObjectReferenceType ref, String contextDescription, OperationResult result) throws ObjectNotFoundException, SchemaException {
    Class<? extends ObjectType> type = ObjectType.class;
    if (ref.getType() != null) {
        ObjectTypes objectTypeType = ObjectTypes.getObjectTypeFromTypeQName(ref.getType());
        type = objectTypeType.getClassDefinition();
    }
    return repositoryService.getObject(type, ref.getOid(), null, result).asObjectable();
}
Also used : ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes)

Aggregations

ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)17 QName (javax.xml.namespace.QName)7 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)3 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)3 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)2 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 ObjectTypeGuiDescriptor (com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor)2 ChangeHook (com.evolveum.midpoint.model.api.hooks.ChangeHook)1 HookOperationMode (com.evolveum.midpoint.model.api.hooks.HookOperationMode)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 S_FilterEntryOrEmpty (com.evolveum.midpoint.prism.query.builder.S_FilterEntryOrEmpty)1 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 RepositoryObjectDataProvider (com.evolveum.midpoint.web.component.data.RepositoryObjectDataProvider)1 Table (com.evolveum.midpoint.web.component.data.Table)1 Search (com.evolveum.midpoint.web.component.search.Search)1 PageRepositoryQuery (com.evolveum.midpoint.web.page.admin.configuration.PageRepositoryQuery)1 DebugSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto)1 ConfigurationStorage (com.evolveum.midpoint.web.session.ConfigurationStorage)1