use of com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl in project midpoint by Evolveum.
the class TestSchemaRegistry method testReferenceInExtension.
@Test
public void testReferenceInExtension() throws SchemaException, SAXException, IOException {
MidPointPrismContextFactory factory = getContextFactory();
PrismContext context = factory.createInitializedPrismContext();
SchemaRegistry schemaRegistry = context.getSchemaRegistry();
// Common schema should be parsed during creation of the context
((SchemaRegistryImpl) schemaRegistry).loadPrismSchemaResource("schema/extension.xsd");
// Check that the extension schema was loaded
PrismSchema extensionSchema = schemaRegistry.findSchemaByNamespace(EXTENSION_SCHEMA_NAMESPACE);
assertNotNull("Extension schema not parsed", extensionSchema);
ItemDefinition itemDefinition = schemaRegistry.findItemDefinitionByElementName(TestConstants.EXTENSION_USER_REF_ELEMENT);
assertNotNull("userRef element definition was not found", itemDefinition);
System.out.println("UserRef definition:");
System.out.println(itemDefinition.debugDump());
assertTrue("Wrong userRef definition class: " + itemDefinition.getClass(), itemDefinition instanceof PrismReferenceDefinition);
}
use of com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl in project midpoint by Evolveum.
the class MidPointPrismContextFactory method createSchemaRegistry.
@NotNull
private SchemaRegistryImpl createSchemaRegistry() throws SchemaException, IOException {
SchemaRegistryImpl schemaRegistry = new AxiomEnabledSchemaRegistry();
schemaRegistry.setDefaultNamespace(SchemaConstantsGenerated.NS_COMMON);
schemaRegistry.setNamespacePrefixMapper(new GlobalDynamicNamespacePrefixMapper());
registerBuiltinSchemas(schemaRegistry);
registerExtensionSchemas(schemaRegistry);
registerAxiomSchemas(schemaRegistry);
schemaRegistry.setValueMetadataTypeName(ValueMetadataType.COMPLEX_TYPE);
return schemaRegistry;
}
use of com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl in project midpoint by Evolveum.
the class MidPointPrismContextFactory method createEmptyPrismContext.
public PrismContext createEmptyPrismContext() throws SchemaException, IOException {
SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
PrismContextImpl context = PrismContextImpl.createEmptyContext(schemaRegistry);
context.setDefinitionFactory(createDefinitionFactory());
context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
context.setObjectsElementName(SchemaConstants.C_OBJECTS);
context.setDefaultReferenceTypeName(ObjectReferenceType.COMPLEX_TYPE);
context.setExtensionContainerTypeName(ExtensionType.COMPLEX_TYPE);
return context;
}
use of com.evolveum.midpoint.prism.impl.schema.SchemaRegistryImpl in project midpoint by Evolveum.
the class MidPointPrismContextFactory method createPrismContext.
@Override
public PrismContext createPrismContext() throws SchemaException, IOException {
SchemaRegistryImpl schemaRegistry = createSchemaRegistry();
PrismContextImpl context = PrismContextImpl.create(schemaRegistry);
context.setDefinitionFactory(createDefinitionFactory());
context.setDefaultRelation(SchemaConstants.ORG_DEFAULT);
context.setObjectsElementName(SchemaConstants.C_OBJECTS);
context.setDefaultReferenceTypeName(ObjectReferenceType.COMPLEX_TYPE);
context.setExtensionContainerTypeName(ExtensionType.COMPLEX_TYPE);
if (InternalsConfig.isPrismMonitoring()) {
context.setMonitor(new InternalMonitor());
}
context.setParsingMigrator(new MidpointParsingMigrator());
context.setValueMetadataFactory(new MidpointValueMetadataFactory(context));
context.setProvenanceEquivalenceStrategy(MidpointProvenanceEquivalenceStrategy.INSTANCE);
context.registerQueryExpressionFactory(new PrismQueryExpressionSupport());
return context;
}
Aggregations