Search in sources :

Example 1 with MetadataMappingEvaluator

use of com.evolveum.midpoint.model.common.mapping.metadata.MetadataMappingEvaluator in project midpoint by Evolveum.

the class MappingTestEvaluator method init.

private void init(boolean withMetadata) throws SchemaException, SAXException, IOException {
    this.withMetadata = withMetadata;
    PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX);
    PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY);
    prismContext = PrismTestUtil.createInitializedPrismContext();
    ObjectResolver resolver = new DirectoryFileObjectResolver(MidPointTestConstants.OBJECTS_DIR);
    protector = ExpressionTestUtil.createInitializedProtector(prismContext);
    Clock clock = new Clock();
    ExpressionFactory expressionFactory = ExpressionTestUtil.createInitializedExpressionFactory(resolver, protector, prismContext, clock, null, null);
    // We need only selected beans for the mapping factory
    ModelCommonBeans beans = new ModelCommonBeans();
    beans.expressionFactory = expressionFactory;
    beans.objectResolver = resolver;
    beans.prismContext = prismContext;
    beans.protector = protector;
    if (withMetadata) {
        BuiltinMetadataMappingsRegistry builtinMetadataMappingsRegistry = new BuiltinMetadataMappingsRegistry();
        ProvenanceBuiltinMapping provenanceBuiltinMapping = new ProvenanceBuiltinMapping(prismContext, builtinMetadataMappingsRegistry);
        provenanceBuiltinMapping.register();
        beans.metadataMappingEvaluator = new MetadataMappingEvaluator(mappingFactory, prismContext, builtinMetadataMappingsRegistry);
    }
    mappingFactory = new MappingFactory();
    mappingFactory.setBeans(beans);
    mappingFactory.setProfiling(true);
}
Also used : BuiltinMetadataMappingsRegistry(com.evolveum.midpoint.model.common.mapping.metadata.builtin.BuiltinMetadataMappingsRegistry) ExpressionFactory(com.evolveum.midpoint.repo.common.expression.ExpressionFactory) MetadataMappingEvaluator(com.evolveum.midpoint.model.common.mapping.metadata.MetadataMappingEvaluator) ModelCommonBeans(com.evolveum.midpoint.model.common.ModelCommonBeans) DirectoryFileObjectResolver(com.evolveum.midpoint.repo.common.DirectoryFileObjectResolver) ObjectResolver(com.evolveum.midpoint.repo.common.ObjectResolver) DirectoryFileObjectResolver(com.evolveum.midpoint.repo.common.DirectoryFileObjectResolver) ProvenanceBuiltinMapping(com.evolveum.midpoint.model.common.mapping.metadata.builtin.ProvenanceBuiltinMapping) Clock(com.evolveum.midpoint.common.Clock)

Aggregations

Clock (com.evolveum.midpoint.common.Clock)1 ModelCommonBeans (com.evolveum.midpoint.model.common.ModelCommonBeans)1 MetadataMappingEvaluator (com.evolveum.midpoint.model.common.mapping.metadata.MetadataMappingEvaluator)1 BuiltinMetadataMappingsRegistry (com.evolveum.midpoint.model.common.mapping.metadata.builtin.BuiltinMetadataMappingsRegistry)1 ProvenanceBuiltinMapping (com.evolveum.midpoint.model.common.mapping.metadata.builtin.ProvenanceBuiltinMapping)1 DirectoryFileObjectResolver (com.evolveum.midpoint.repo.common.DirectoryFileObjectResolver)1 ObjectResolver (com.evolveum.midpoint.repo.common.ObjectResolver)1 ExpressionFactory (com.evolveum.midpoint.repo.common.expression.ExpressionFactory)1