use of org.apache.olingo.client.api.edm.xml.XMLMetadata in project teiid by teiid.
the class TestODataMetadataProcessor method oneToOneRelationMetadata.
static MetadataFactory oneToOneRelationMetadata(boolean bothDirections) throws TranslatorException {
ODataMetadataProcessor processor = new ODataMetadataProcessor();
MetadataFactory mf = new MetadataFactory("vdb", 1, "northwind", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
CsdlEntityType g1Entity = entityType("g1");
CsdlEntityType g2Entity = entityType("g2");
CsdlNavigationProperty navProperty = new CsdlNavigationProperty();
navProperty.setName("one_2_one");
navProperty.setType("namespace.g2");
navProperty.setNullable(false);
navProperty.setPartner("PartnerPath");
g1Entity.setNavigationProperties(Arrays.asList(navProperty));
if (bothDirections) {
CsdlNavigationProperty nav2Property = new CsdlNavigationProperty();
nav2Property.setName("one_2_one");
nav2Property.setType("namespace.g1");
nav2Property.setNullable(false);
nav2Property.setPartner("PartnerPath");
g2Entity.setNavigationProperties(Arrays.asList(nav2Property));
}
CsdlEntitySet g1Set = createES("G1", "namespace.g1");
CsdlEntitySet g2Set = createES("G2", "namespace.g2");
CsdlNavigationPropertyBinding navBinding = new CsdlNavigationPropertyBinding();
navBinding.setPath("one_2_one");
navBinding.setTarget("G2");
g1Set.setNavigationPropertyBindings(Arrays.asList(navBinding));
if (bothDirections) {
CsdlNavigationPropertyBinding nav2Binding = new CsdlNavigationPropertyBinding();
nav2Binding.setPath("one_2_one");
nav2Binding.setTarget("G1");
g2Set.setNavigationPropertyBindings(Arrays.asList(nav2Binding));
}
XMLMetadata metadata = buildXmlMetadata(g1Entity, g1Set, g2Entity, g2Set);
processor.getMetadata(mf, metadata);
return mf;
}
use of org.apache.olingo.client.api.edm.xml.XMLMetadata in project teiid by teiid.
the class TestODataMetadataProcessor method getEntityWithComplexProperty.
static MetadataFactory getEntityWithComplexProperty() throws TranslatorException {
ODataMetadataProcessor processor = new ODataMetadataProcessor();
MetadataFactory mf = new MetadataFactory("vdb", 1, "northwind", SystemMetadata.getInstance().getRuntimeTypeMap(), new Properties(), null);
CsdlComplexType address = complexType("Address");
XMLMetadata metadata = buildXmlMetadata(createES("Persons", "namespace.Person"), buildPersonEntity(address), address);
processor.getMetadata(mf, metadata);
return mf;
}
Aggregations