当前位置: 首页>>代码示例>>Java>>正文


Java Schema.getEntityContainers方法代码示例

本文整理汇总了Java中org.apache.olingo.odata2.api.edm.provider.Schema.getEntityContainers方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.getEntityContainers方法的具体用法?Java Schema.getEntityContainers怎么用?Java Schema.getEntityContainers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.olingo.odata2.api.edm.provider.Schema的用法示例。


在下文中一共展示了Schema.getEntityContainers方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: schemaBasic

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:AnnotationEdmProviderTest.java

示例2: getAssociationSet

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:EdmxProvider.java

示例3: createEntitySets

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:EdmImplProv.java

示例4: createFunctionImports

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:EdmImplProv.java

示例5: testAssociationSet

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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());
      }
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:XmlMetadataConsumerTest.java

示例6: getEntityContainerMap

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:12,代码来源:EdmEntityContainerImplProv.java

示例7: getEntitySet

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:16,代码来源:EdmxProvider.java

示例8: getFunctionImport

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:16,代码来源:EdmxProvider.java

示例9: testEntitySet

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@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());
      }
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:28,代码来源:XmlMetadataConsumerTest.java

示例10: testEntityTypeInOtherSchema

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Test
public void testEntityTypeInOtherSchema() 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\"/>" + "</EntityType>"
          + "<EntityContainer Name=\"Container1\" m:IsDefaultEntityContainer=\"true\">"
          + "<EntitySet Name=\"Photos\" EntityType=\"" + NAMESPACE2 + ".Photo\"/>" + "</EntityContainer>"
          + "</Schema>" + "<Schema Namespace=\"" + NAMESPACE2 + "\" xmlns=\"" + Edm.NAMESPACE_EDM_2008_09 + "\">"
          + "<EntityType Name= \"Photo\">" + "<Key><PropertyRef Name=\"Id\"/></Key>"
          + "<Property Name=\"Id\" Type=\"Edm.Int32\" Nullable=\"false\"/>" + "</EntityType>" + "</Schema>"
          + "</edmx:DataServices>"
          + "</edmx:Edmx>";
  XmlMetadataConsumer parser = new XmlMetadataConsumer();
  XMLStreamReader reader = createStreamReader(xmWithEntityContainer);
  DataServices result = parser.readMetadata(reader, true);
  assertEquals("2.0", result.getDataServiceVersion());
  for (Schema schema : result.getSchemas()) {
    for (EntityContainer container : schema.getEntityContainers()) {
      assertEquals("Container1", container.getName());
      for (EntitySet entitySet : container.getEntitySets()) {
        assertEquals(NAMESPACE2, entitySet.getEntityType().getNamespace());
        assertEquals("Photo", entitySet.getEntityType().getName());
      }
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:30,代码来源:XmlMetadataConsumerTest.java


注:本文中的org.apache.olingo.odata2.api.edm.provider.Schema.getEntityContainers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。