org.apache.olingo.odata2.api.edm.provider.EntityContainer Java Examples
The following examples show how to use
org.apache.olingo.odata2.api.edm.provider.EntityContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException { EntityContainer container = name2Container.get(entityContainer); if (container != null) { List<AssociationSet> associations = container.getAssociationSets(); for (AssociationSet associationSet : associations) { if (associationSet.getAssociation().equals(association)) { final AssociationSetEnd endOne = associationSet.getEnd1(); if (endOne.getRole().equals(sourceEntitySetRole) && endOne.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } final AssociationSetEnd endTwo = associationSet.getEnd2(); if (endTwo.getRole().equals(sourceEntitySetRole) && endTwo.getEntitySet().equals(sourceEntitySetName)) { return associationSet; } } } } return null; }
Example #2
Source File: TechnicalScenarioEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public List<Schema> getSchemas() throws ODataMessageException { final Schema schema = new Schema(); schema.setNamespace(NAMESPACE_1); schema.setEntityTypes(Arrays.asList( getEntityType(ET_KEY_IS_STRING), getEntityType(ET_KEY_IS_INTEGER), getEntityType(ET_COMPLEX_KEY), getEntityType(ET_ALL_TYPES))); schema.setComplexTypes(Arrays.asList(getComplexType(CT_ALL_TYPES))); final EntityContainer entityContainer = new EntityContainer(); entityContainer.setName(ENTITY_CONTAINER_1).setDefaultEntityContainer(true); entityContainer.setEntitySets(Arrays.asList( getEntitySet(ENTITY_CONTAINER_1, ES_KEY_IS_STRING), getEntitySet(ENTITY_CONTAINER_1, ES_KEY_IS_INTEGER), getEntitySet(ENTITY_CONTAINER_1, ES_COMPLEX_KEY), getEntitySet(ENTITY_CONTAINER_1, ES_ALL_TYPES), getEntitySet(ENTITY_CONTAINER_1, ES_STRING_FACETS))); schema.setEntityContainers(Arrays.asList(entityContainer)); return Arrays.asList(schema); }
Example #3
Source File: EdmServiceMetadataImplProvTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void oneEntitySetsOneContainerTwoSchemadForInfo() throws Exception { List<EntitySet> entitySets = new ArrayList<EntitySet>(); EntitySet entitySet = new EntitySet().setName("Employees"); entitySets.add(entitySet); List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); EntityContainer container = new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets); entityContainers.add(container); List<Schema> schemas = new ArrayList<Schema>(); schemas.add(new Schema().setEntityContainers(entityContainers)); schemas.add(new Schema().setEntityContainers(entityContainers)); EdmProvider edmProvider = mock(EdmProvider.class); when(edmProvider.getSchemas()).thenReturn(schemas); EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider); List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos(); assertNotNull(infos); assertEquals(2, infos.size()); }
Example #4
Source File: EdmServiceMetadataImplProvTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void twoEntitySetsOneContainerForInfo() throws Exception { List<EntitySet> entitySets = new ArrayList<EntitySet>(); EntitySet entitySet = new EntitySet().setName("Employees"); entitySets.add(entitySet); entitySets.add(entitySet); List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); EntityContainer container = new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets); entityContainers.add(container); List<Schema> schemas = new ArrayList<Schema>(); schemas.add(new Schema().setEntityContainers(entityContainers)); EdmProvider edmProvider = mock(EdmProvider.class); when(edmProvider.getSchemas()).thenReturn(schemas); EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider); List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos(); assertNotNull(infos); assertEquals(2, infos.size()); }
Example #5
Source File: XmlMetadataConsumerTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void testAssociationSet() throws XMLStreamException, EntityProviderException { XmlMetadataConsumer parser = new XmlMetadataConsumer(); XMLStreamReader reader = createStreamReader(xmlWithAssociation); DataServices result = parser.readMetadata(reader, true); for (Schema schema : result.getSchemas()) { for (EntityContainer container : schema.getEntityContainers()) { assertEquals(NAMESPACE2, schema.getNamespace()); assertEquals("Container1", container.getName()); assertEquals(Boolean.TRUE, container.isDefaultEntityContainer()); for (AssociationSet assocSet : container.getAssociationSets()) { assertEquals(ASSOCIATION, assocSet.getName()); assertEquals(ASSOCIATION, assocSet.getAssociation().getName()); assertEquals(NAMESPACE, assocSet.getAssociation().getNamespace()); AssociationSetEnd end; if ("Employees".equals(assocSet.getEnd1().getEntitySet())) { end = assocSet.getEnd1(); } else { end = assocSet.getEnd2(); } assertEquals("r_Employees", end.getRole()); } } } }
Example #6
Source File: AtomServiceDocumentProducerTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void writeServiceDocumentWithOneEnitySetTwoContainersOneSchema() throws Exception { List<EntitySet> entitySets = new ArrayList<EntitySet>(); entitySets.add(new EntitySet().setName("Employees")); List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets( entitySets)); entityContainers.add(new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets( entitySets)); schemas.add(new Schema().setEntityContainers(entityContainers)); ODataResponse response = new AtomEntityProvider().writeServiceDocument(edm, "http://localhost"); String xmlString = verifyResponse(response); assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString); assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString); assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString); assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString); assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString); assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Container2.Employees']/atom:title", xmlString); }
Example #7
Source File: AtomServiceDocumentProducerTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void writeServiceDocumentWithOneEnitySetOneContainerOneSchema() throws Exception { List<EntitySet> entitySets = new ArrayList<EntitySet>(); entitySets.add(new EntitySet().setName("Employees")); List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); entityContainers.add(new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets( entitySets)); schemas.add(new Schema().setEntityContainers(entityContainers)); ODataResponse response = new AtomEntityProvider().writeServiceDocument(edm, "http://localhost"); String xmlString = verifyResponse(response); assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']", xmlString); assertXpathExists("/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString); assertXpathEvaluatesTo("Employees", "/a:service/a:workspace/a:collection[@href='Employees']/atom:title", xmlString); }
Example #8
Source File: EdmImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override protected List<EdmFunctionImport> createFunctionImports() throws ODataException { List<EdmFunctionImport> edmFunctionImports = new ArrayList<EdmFunctionImport>(); if (schemas == null) { schemas = edmProvider.getSchemas(); } for (Schema schema : schemas) { for (EntityContainer entityContainer : schema.getEntityContainers()) { for (FunctionImport functionImport : entityContainer.getFunctionImports()) { EdmEntityContainer edmEntityContainer = createEntityContainer(entityContainer.getName()); edmFunctionImports.add(new EdmFunctionImportImplProv(this, functionImport, edmEntityContainer)); } } } return edmFunctionImports; }
Example #9
Source File: EdmImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override protected List<EdmEntitySet> createEntitySets() throws ODataException { List<EdmEntitySet> edmEntitySets = new ArrayList<EdmEntitySet>(); if (schemas == null) { schemas = edmProvider.getSchemas(); } for (Schema schema : schemas) { for (EntityContainer entityContainer : schema.getEntityContainers()) { for (EntitySet entitySet : entityContainer.getEntitySets()) { EdmEntityContainer edmEntityContainer = createEntityContainer(entityContainer.getName()); edmEntitySets.add(new EdmEntitySetImplProv(this, entitySet, edmEntityContainer)); } } } return edmEntitySets; }
Example #10
Source File: EdmxProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException { for (Schema schema : dataServices.getSchemas()) { for (EntityContainer container : schema.getEntityContainers()) { if (container.getName().equals(entityContainer)) { for (AssociationSet associationSet : container.getAssociationSets()) { if (associationSet.getAssociation().equals(association) && ((associationSet.getEnd1().getEntitySet().equals(sourceEntitySetName) && associationSet.getEnd1() .getRole().equals(sourceEntitySetRole)) || (associationSet.getEnd2().getEntitySet().equals(sourceEntitySetName) && associationSet.getEnd2() .getRole().equals(sourceEntitySetRole)))) { return associationSet; } } } } } return null; }
Example #11
Source File: EdmServiceMetadataImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public List<EdmEntitySetInfo> getEntitySetInfos() throws ODataException { if(edmProvider == null){ throw new ODataException(EDM_PROVIDER_EXEPTION); } if (entitySetInfos == null) { entitySetInfos = new ArrayList<EdmEntitySetInfo>(); if (schemas == null) { schemas = edmProvider.getSchemas(); } for (Schema schema : schemas) { for (EntityContainer entityContainer : listOrEmptyList(schema.getEntityContainers())) { for (EntitySet entitySet : listOrEmptyList(entityContainer.getEntitySets())) { EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, entityContainer); entitySetInfos.add(entitySetInfo); } } } } return entitySetInfos; }
Example #12
Source File: EdmEntityContainerImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public String getNamespace() throws EdmException{ try { if (namespace == null) { List<Schema> schemas; schemas = edm.edmProvider.getSchemas(); for (Schema schema : schemas) { List<EntityContainer> containers = schema.getEntityContainers(); for (EntityContainer container : containers) { if (container.getName().equals(entityContainerInfo.getName())) { this.namespace = schema.getNamespace(); break; } } if (namespace != null) { break; } } } } catch (ODataException e) { throw new EdmException(EdmException.PROVIDERPROBLEM, e); } return namespace; }
Example #13
Source File: EdmEntityContainerImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
private List<EntityContainer> getEntityContainerHierachy() throws ODataException { if (entityContainerHierachy != null) { return entityContainerHierachy; } entityContainerHierachy = new ArrayList<EntityContainer>(); Map<String, EntityContainer> name2Container = getEntityContainerMap(); String currentName = getName(); while (currentName != null) { EntityContainer currentContainer = name2Container.get(currentName); entityContainerHierachy.add(currentContainer); currentName = currentContainer.getExtendz(); } if (entityContainerHierachy.isEmpty()) { throw new EdmException(EdmException.PROVIDERPROBLEM, "No container at all found."); } return entityContainerHierachy; }
Example #14
Source File: EdmEntityContainerImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public List<EdmAssociationSet> getAssociationSets() throws EdmException { try { List<EntityContainer> containers = getEntityContainerHierachy(); List<EdmAssociationSet> edmAssociationSetsList = new ArrayList<EdmAssociationSet>(); for (EntityContainer entityContainer : containers) { List<AssociationSet> associationSets = entityContainer.getAssociationSets(); for (AssociationSet associationSet : associationSets) { EdmAssociationSet eas = createAssociationSet(associationSet); edmAssociationSetsList.add(eas); } } return edmAssociationSetsList; } catch (ODataException e) { throw new EdmException(EdmException.PROVIDERPROBLEM, e); } }
Example #15
Source File: EdmEntityContainerImplProv.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public List<EdmEntitySet> getEntitySets() throws EdmException { try { List<EdmEntitySet> edmEntitySetsList = new ArrayList<EdmEntitySet>(); List<EntityContainer> entityContainerHierachyList = getEntityContainerHierachy(); for (EntityContainer entityContainer : entityContainerHierachyList) { List<EntitySet> entitySets = entityContainer.getEntitySets(); for (EntitySet entitySet : entitySets) { EdmEntitySet ees = createEntitySet(entitySet); edmEntitySetsList.add(ees); } } return edmEntitySetsList; } catch (ODataException e) { throw new EdmException(EdmException.PROVIDERPROBLEM, e); } }
Example #16
Source File: AnnotationEdmProviderTest.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Test public void schemaBasic() throws Exception { assertNotNull(aep); List<Schema> schemas = aep.getSchemas(); assertEquals(1, schemas.size()); Schema schema = schemas.get(0); List<EntityContainer> containers = schema.getEntityContainers(); assertEquals(1, containers.size()); EntityContainer container = containers.get(0); assertEquals(ModelSharedConstants.CONTAINER_1, container.getName()); final List<EntitySet> entitySets = container.getEntitySets(); assertEquals(6, entitySets.size()); List<Association> associations = schema.getAssociations(); assertEquals(5, associations.size()); for (Association association : associations) { assertNotNull(association.getName()); validateAssociation(association); } }
Example #17
Source File: ODataJPAEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException { if (entityContainerInfos.containsKey(name)) { return entityContainerInfos.get(name); } else { if (schemas == null) { getSchemas(); } List<EntityContainer> containerList = schemas.get(0).getEntityContainers(); if (containerList == null) { return null; } for (EntityContainer container : containerList) { if (name == null && container.isDefaultEntityContainer()) { entityContainerInfos.put(name, container); return container; } else if (name != null && name.equals(container.getName())) { return container; } } } return null; }
Example #18
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 6 votes |
@Override public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException { EntityContainer container = name2Container.get(name); if (container == null) { // use default container (if set) container = defaultContainer; } if (container != null) { EntityContainerInfo info = new EntityContainerInfo(); info.setName(container.getName()); info.setDefaultEntityContainer(container.isDefaultEntityContainer()); info.setExtendz(container.getExtendz()); info.setAnnotationAttributes(container.getAnnotationAttributes()); info.setAnnotationElements(container.getAnnotationElements()); return info; } return null; }
Example #19
Source File: JPAEdmEntityContainer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public void build() throws ODataJPAModelException, ODataJPARuntimeException { currentEntityContainer = new EntityContainer(); if (consistentEntityContainerList == null) { currentEntityContainer.setDefaultEntityContainer(true); consistentEntityContainerList = new ArrayList<EntityContainer>(); } entitySetView = new JPAEdmEntitySet(schemaView); entitySetView.getBuilder().build(); if (entitySetView.isConsistent()) { currentEntityContainer.setEntitySets(entitySetView.getConsistentEdmEntitySetList()); } else { isConsistent = false; return; } if (!schemaView.getJPAEdmAssociationView().isConsistent()) { schemaView.getJPAEdmAssociationView().getBuilder().build(); } associationSetView = new JPAEdmAssociationSet(schemaView); associationSetView.getBuilder().build(); if (associationSetView.isConsistent()) { currentEntityContainer.setAssociationSets(associationSetView.getConsistentEdmAssociationSetList()); } else { isConsistent = false; return; } JPAEdmNameBuilder.build(JPAEdmEntityContainer.this); consistentEntityContainerList.add(currentEntityContainer); isConsistent = true; }
Example #20
Source File: XmlMetadataConsumerTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void testEntitySet() throws XMLStreamException, EntityProviderException { final String xmWithEntityContainer = "<edmx:Edmx Version=\"1.0\" xmlns:edmx=\"" + Edm.NAMESPACE_EDMX_2007_06 + "\">" + "<edmx:DataServices m:DataServiceVersion=\"2.0\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">" + "<Schema Namespace=\"" + NAMESPACE + "\" xmlns=\"" + Edm.NAMESPACE_EDM_2008_09 + "\">" + "<EntityType Name= \"Employee\" m:HasStream=\"true\">" + "<Key><PropertyRef Name=\"EmployeeId\"/></Key>" + "<Property Name=\"" + propertyNames[0] + "\" Type=\"Edm.String\" Nullable=\"false\"/>" + "<Property Name=\"" + propertyNames[1] + "\" Type=\"Edm.String\" m:FC_TargetPath=\"SyndicationTitle\"/>" + "</EntityType>" + "<EntityContainer Name=\"Container1\" m:IsDefaultEntityContainer=\"true\">" + "<EntitySet Name=\"Employees\" EntityType=\"RefScenario.Employee\"/>" + "</EntityContainer>" + "</Schema>" + "</edmx:DataServices>" + "</edmx:Edmx>"; XmlMetadataConsumer parser = new XmlMetadataConsumer(); XMLStreamReader reader = createStreamReader(xmWithEntityContainer); DataServices result = parser.readMetadata(reader, true); for (Schema schema : result.getSchemas()) { for (EntityContainer container : schema.getEntityContainers()) { assertEquals("Container1", container.getName()); assertEquals(Boolean.TRUE, container.isDefaultEntityContainer()); for (EntitySet entitySet : container.getEntitySets()) { assertEquals("Employees", entitySet.getName()); assertEquals("Employee", entitySet.getEntityType().getName()); assertEquals(NAMESPACE, entitySet.getEntityType().getNamespace()); } } } }
Example #21
Source File: EdmServiceMetadataImplProvTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void oneEntitySetOneContainerForInfo() throws Exception { String entitySetUriString = new URI("Employees").toASCIIString(); List<EntitySet> entitySets = new ArrayList<EntitySet>(); EntitySet entitySet = new EntitySet().setName("Employees"); entitySets.add(entitySet); List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); EntityContainer container = new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets); entityContainers.add(container); List<Schema> schemas = new ArrayList<Schema>(); schemas.add(new Schema().setEntityContainers(entityContainers)); EdmProvider edmProvider = mock(EdmProvider.class); when(edmProvider.getSchemas()).thenReturn(schemas); EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider); List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos(); assertNotNull(infos); assertEquals(1, infos.size()); assertEquals(infos.get(0).getEntitySetName(), "Employees"); assertEquals(infos.get(0).getEntityContainerName(), "Container"); assertEquals(infos.get(0).getEntitySetUri().toASCIIString(), entitySetUriString); assertTrue(infos.get(0).isDefaultEntityContainer()); }
Example #22
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
public EntityContainer build() { EntityContainer ec = new EntityContainer(); ec.setName(name); ec.setDefaultEntityContainer(defaultContainer); ec.setEntitySets(entitySets); ec.setAssociationSets(associationSets); ec.setFunctionImports(functionImports); return ec; }
Example #23
Source File: EdmxProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public FunctionImport getFunctionImport(final String entityContainer, final String name) throws ODataException { for (Schema schema : dataServices.getSchemas()) { for (EntityContainer container : schema.getEntityContainers()) { if (container.getName().equals(entityContainer)) { for (FunctionImport function : container.getFunctionImports()) { if (function.getName().equals(name)) { return function; } } } } } return null; }
Example #24
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException { EntityContainer container = name2Container.get(entityContainer); if (container != null) { List<EntitySet> entitySets = container.getEntitySets(); for (EntitySet entitySet : entitySets) { if (entitySet.getName().equals(name)) { return entitySet; } } } return null; }
Example #25
Source File: EdmxProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException { for (Schema schema : dataServices.getSchemas()) { for (EntityContainer container : schema.getEntityContainers()) { if (container.getName().equals(entityContainer)) { for (EntitySet entitySet : container.getEntitySets()) { if (entitySet.getName().equals(name)) { return entitySet; } } } } } return null; }
Example #26
Source File: EdmServiceMetadataImplProvTest.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Test public void twoContainersWithOneEntitySetEachForInfo() throws Exception { String entitySetUriString = new URI("Employees").toASCIIString(); String entitySetUriString2 = new URI("Container2.Employees").toASCIIString(); List<EntitySet> entitySets = new ArrayList<EntitySet>(); EntitySet entitySet = new EntitySet().setName("Employees"); entitySets.add(entitySet); List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); EntityContainer container = new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets); entityContainers.add(container); EntityContainer container2 = new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(entitySets); entityContainers.add(container2); List<Schema> schemas = new ArrayList<Schema>(); schemas.add(new Schema().setEntityContainers(entityContainers)); EdmProvider edmProvider = mock(EdmProvider.class); when(edmProvider.getSchemas()).thenReturn(schemas); EdmServiceMetadata serviceMetadata = new EdmServiceMetadataImplProv(edmProvider); List<EdmEntitySetInfo> infos = serviceMetadata.getEntitySetInfos(); assertNotNull(infos); assertEquals(2, infos.size()); assertEquals(infos.get(0).getEntitySetName(), "Employees"); assertEquals(infos.get(0).getEntityContainerName(), "Container"); assertEquals(infos.get(0).getEntitySetUri().toASCIIString(), entitySetUriString); assertTrue(infos.get(0).isDefaultEntityContainer()); assertEquals(infos.get(1).getEntitySetName(), "Employees"); assertEquals(infos.get(1).getEntityContainerName(), "Container2"); assertEquals(infos.get(1).getEntitySetUri().toASCIIString(), entitySetUriString2); assertFalse(infos.get(1).isDefaultEntityContainer()); }
Example #27
Source File: EdmSchemaMock.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private static List<EntityContainer> createEntityContainer() { List<EntityContainer> entityContainers = new ArrayList<EntityContainer>(); EntityContainer entityContainer = new EntityContainer(); entityContainer.setDefaultEntityContainer(true); entityContainer.setName(ENTITY_CONTAINER_NAME); entityContainer.setEntitySets(createEntitySets()); entityContainer.setAssociationSets(createAssociationSets()); entityContainer.setFunctionImports(createFunctionImports()); entityContainers.add(entityContainer); return entityContainers; }
Example #28
Source File: EdmEntityContainerImplProv.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private Map<String, EntityContainer> getEntityContainerMap() throws ODataException { Map<String, EntityContainer> name2Container = new HashMap<String, EntityContainer>(); List<Schema> schemas = edm.edmProvider.getSchemas(); for (Schema schema : schemas) { List<EntityContainer> containers = schema.getEntityContainers(); for (EntityContainer container : containers) { name2Container.put(container.getName(), container); } } return name2Container; }
Example #29
Source File: AnnotationEdmProvider.java From olingo-odata2 with Apache License 2.0 | 5 votes |
@Override public FunctionImport getFunctionImport(final String entityContainer, final String name) throws ODataException { EntityContainer container = name2Container.get(entityContainer); if (container != null) { List<FunctionImport> functionImports = container.getFunctionImports(); for (FunctionImport functionImport : functionImports) { if (functionImport.getName().equals(name)) { return functionImport; } } } return null; }
Example #30
Source File: XmlMetadataConsumer.java From olingo-odata2 with Apache License 2.0 | 5 votes |
private void validateEntitySet() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityContainer> container : containerMap.entrySet()) { for (EntitySet entitySet : container.getValue().getEntitySets()) { FullQualifiedName entityType = entitySet.getEntityType(); if (!(entityTypesMap.containsKey(entityType))) { validateEntityTypeWithAlias(entityType); } } } }