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


Java Schema.setEntityTypes方法代码示例

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


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

示例1: getSchemas

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

示例2: build

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
public Schema build() {
  Schema s = new Schema();
  s.setUsings(usings);
  s.setEntityTypes(entityTypes);
  s.setComplexTypes(complexTypes);
  s.setAssociations(new ArrayList<Association>(name2Associations.values()));
  s.setEntityContainers(entityContainers);
  s.setAnnotationAttributes(annotationAttributes);
  s.setAnnotationElements(annotationElements);
  s.setNamespace(namespace);
  return s;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:13,代码来源:AnnotationEdmProvider.java

示例3: createMockEdmSchema

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
public static Schema createMockEdmSchema() {
  Schema schema = new Schema();
  schema.setNamespace(NAMESPACE);
  schema.setComplexTypes(createComplexTypes());
  schema.setEntityContainers(createEntityContainer());
  schema.setEntityTypes(createEntityTypes());
  schema.setAssociations(createAssociations());
  return schema;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:10,代码来源:EdmSchemaMock.java

示例4: getSchemas

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public List<Schema> getSchemas() throws ODataException
{
   List<Schema> schemas = new ArrayList<>();

   Schema schema = new Schema();
   schema.setNamespace(NAMESPACE);

   fr.gael.dhus.database.object.User u = Security.getCurrentUser();

   ArrayList<EntityType> entities = new ArrayList<>();
   ArrayList<EntitySet> entitysets = new ArrayList<>();
   ArrayList<Association> associations = new ArrayList<>();
   ArrayList<AssociationSet> association_sets = new ArrayList<>();
   List<FunctionImport> function_imports = new ArrayList<>();

   for (AbstractEntitySet<?> entitySet: ENTITYSETS.values())
   {
      if (entitySet.isAuthorized(u))
      {
         entities.add(entitySet.getEntityType());
         entitysets.add(entitySet.getEntitySet());
         associations.addAll(entitySet.getAssociations());
         association_sets.addAll(entitySet.getAssociationSets());
      }
   }

   for (AbstractOperation op: OPERATIONS.values())
   {
      if (op.canExecute(u))
      {
         function_imports.add(op.getFunctionImport());
      }
   }

   schema.setEntityTypes(entities);
   schema.setComplexTypes(new ArrayList<>(COMPLEX_TYPES.values()));
   schema.setAssociations(new ArrayList<>(associations));

   EntityContainer entityContainer = new EntityContainer();
   entityContainer.setName(ENTITY_CONTAINER).setDefaultEntityContainer(true);

   entityContainer.setEntitySets(entitysets);
   entityContainer.setAssociationSets(new ArrayList<>(association_sets));
   entityContainer.setFunctionImports(function_imports);

   schema.setEntityContainers(Collections.singletonList(entityContainer));

   schemas.add(schema);

   return schemas;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:53,代码来源:Model.java

示例5: writeValidMetadata3

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Test
public void writeValidMetadata3() throws Exception {
  List<Schema> schemas = new ArrayList<Schema>();

  List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>();
  annotationElements.add(new AnnotationElement().setName("test").setText("hallo)"));
  Schema schema = new Schema().setAnnotationElements(annotationElements);
  schema.setNamespace("http://namespace.com");
  schemas.add(schema);

  List<PropertyRef> keys = new ArrayList<PropertyRef>();
  keys.add(new PropertyRef().setName("Id"));
  Key key = new Key().setKeys(keys);
  List<Property> properties = new ArrayList<Property>();
  properties.add(new SimpleProperty().setName("Id").setType(EdmSimpleTypeKind.String));
  EntityType entityType = new EntityType().setName("testType").setKey(key).setProperties(properties);
  entityType.setDocumentation(new Documentation());

  List<PropertyRef> keys2 = new ArrayList<PropertyRef>();
  keys2.add(new PropertyRef().setName("SecondId"));
  Key key2 = new Key().setKeys(keys2);
  List<Property> properties2 = new ArrayList<Property>();
  properties2.add(new SimpleProperty().setName("SecondId").setType(EdmSimpleTypeKind.String));
  EntityType entityType2 = new EntityType().setName("SecondTestType").setKey(key2).setProperties(properties2);
  entityType2.setDocumentation(new Documentation().setSummary("Doc_TlDr").setLongDescription("Some long desc."));
  List<EntityType> entityTypes = new ArrayList<EntityType>();
  entityTypes.add(entityType);
  entityTypes.add(entityType2);
  schema.setEntityTypes(entityTypes);

  DataServices data = new DataServices().setSchemas(schemas).setDataServiceVersion(ODataServiceVersion.V20);
  CircleStreamBuffer csb = new CircleStreamBuffer();
  OutputStreamWriter writer = new OutputStreamWriter(csb.getOutputStream(), "UTF-8");
  XMLStreamWriter xmlStreamWriter = xmlStreamWriterFactory.createXMLStreamWriter(writer);
  XmlMetadataProducer.writeMetadata(data, xmlStreamWriter, null);

  Map<String, String> prefixMap = new HashMap<String, String>();
  prefixMap.put("edmx", "http://schemas.microsoft.com/ado/2007/06/edmx");
  prefixMap.put("a", "http://schemas.microsoft.com/ado/2008/09/edm");

  NamespaceContext ctx = new SimpleNamespaceContext(prefixMap);
  XMLUnit.setXpathNamespaceContext(ctx);

  String metadata = StringHelper.inputStreamToString(csb.getInputStream());
  assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:test", metadata);

  assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/a:EntityType[@Name=\"testType\"]", metadata);
  assertXpathExists("/edmx:Edmx/edmx:DataServices/a:Schema/" +
          "a:EntityType[@Name=\"SecondTestType\"]/a:Documentation/a:Summary", metadata);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:51,代码来源:XmlMetadataProducerTest.java

示例6: buildSchema

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
private void buildSchema() {
  propertyRef = new PropertyRef();
  propertyRef.setName("p1");

  key = new Key();
  key.setKeys(Arrays.asList(propertyRef));

  property1 =
      new SimpleProperty().setName(mapping[P1][EDM]).setType(EdmSimpleTypeKind.String).setMapping(
          new Mapping().setObject(mapping[P1][BACKEND]));
  property2 =
      new SimpleProperty().setName(mapping[P2][EDM]).setType(EdmSimpleTypeKind.String).setMapping(
          new Mapping().setObject(mapping[P2][BACKEND]));
  property3 =
      new SimpleProperty().setName(mapping[P3][EDM]).setType(EdmSimpleTypeKind.String).setMapping(
          new Mapping().setObject(mapping[P3][BACKEND]));

  entityType = new EntityType();
  entityType.setName(mapping[ENTITYTYPE][EDM]);
  entityType.setKey(key);
  entityType.setProperties(Arrays.asList(property1, property2, property3));
  entityType.setMapping(new Mapping().setObject(mapping[ENTITYTYPE][BACKEND]));

  entitySet = new EntitySet();
  entitySet.setName(mapping[ENTITYSET][EDM]);
  entitySet.setEntityType(new FullQualifiedName(NAMESPACE, mapping[ENTITYTYPE][EDM]));
  entitySet.setMapping(new Mapping().setObject(mapping[ENTITYSET][BACKEND]));

  entityContainer = new EntityContainer();
  entityContainer.setDefaultEntityContainer(true);
  entityContainer.setName(MAPPING_CONTAINER);
  entityContainer.setEntitySets(Arrays.asList(entitySet));

  schema = new Schema();
  schema.setNamespace("mapping");
  schema.setAlias(NAMESPACE);
  schema.setEntityContainers(Arrays.asList(entityContainer));
  schema.setEntityTypes(Arrays.asList(entityType));

  schemas = Arrays.asList(schema);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:42,代码来源:MapProvider.java

示例7: getSchemas

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public List<Schema> getSchemas() throws ODataException {
  List<Schema> schemas = new ArrayList<Schema>();

  Schema schema = new Schema();
  schema.setNamespace(NAMESPACE);

  List<EntityType> entityTypes = new ArrayList<EntityType>();
  entityTypes.add(getEntityType(ENTITY_TYPE_1_1));
  entityTypes.add(getEntityType(ENTITY_TYPE_1_2));
  schema.setEntityTypes(entityTypes);

  List<ComplexType> complexTypes = new ArrayList<ComplexType>();
  complexTypes.add(getComplexType(COMPLEX_TYPE));
  schema.setComplexTypes(complexTypes);

  List<Association> associations = new ArrayList<Association>();
  associations.add(getAssociation(ASSOCIATION_CAR_MANUFACTURER));
  schema.setAssociations(associations);

  List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
  EntityContainer entityContainer = new EntityContainer();
  entityContainer.setName(ENTITY_CONTAINER).setDefaultEntityContainer(true);

  List<EntitySet> entitySets = new ArrayList<EntitySet>();
  entitySets.add(getEntitySet(ENTITY_CONTAINER, ENTITY_SET_NAME_CARS));
  entitySets.add(getEntitySet(ENTITY_CONTAINER, ENTITY_SET_NAME_MANUFACTURERS));
  entityContainer.setEntitySets(entitySets);

  List<AssociationSet> associationSets = new ArrayList<AssociationSet>();
  associationSets.add(getAssociationSet(ENTITY_CONTAINER, ASSOCIATION_CAR_MANUFACTURER,
      ENTITY_SET_NAME_MANUFACTURERS, ROLE_1_2));
  entityContainer.setAssociationSets(associationSets);

  List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
  functionImports.add(getFunctionImport(ENTITY_CONTAINER, FUNCTION_IMPORT));
  entityContainer.setFunctionImports(functionImports);

  entityContainers.add(entityContainer);
  schema.setEntityContainers(entityContainers);

  schemas.add(schema);

  return schemas;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:46,代码来源:CarEdmProvider.java

示例8: getSchemas

import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public List<Schema> getSchemas() throws ODataException {
    List<Schema> schemas = new ArrayList<>();

    Schema schema = new Schema();
    schema.setNamespace(NAMESPACE);

    List<EntityType> entityTypes = new ArrayList<>();
    entityTypes.add(getEntityType(ENTITY_TYPE_1_1));
    entityTypes.add(getEntityType(ENTITY_TYPE_1_2));
    schema.setEntityTypes(entityTypes);

    List<ComplexType> complexTypes = new ArrayList<>();
    complexTypes.add(getComplexType(COMPLEX_TYPE));
    schema.setComplexTypes(complexTypes);

    List<Association> associations = new ArrayList<>();
    associations.add(getAssociation(ASSOCIATION_CAR_MANUFACTURER));
    schema.setAssociations(associations);

    List<EntityContainer> entityContainers = new ArrayList<>();
    EntityContainer entityContainer = new EntityContainer();
    entityContainer.setName(ENTITY_CONTAINER).setDefaultEntityContainer(true);

    List<EntitySet> entitySets = new ArrayList<>();
    entitySets.add(getEntitySet(ENTITY_CONTAINER, ENTITY_SET_NAME_CARS));
    entitySets.add(getEntitySet(ENTITY_CONTAINER, ENTITY_SET_NAME_MANUFACTURERS));
    entityContainer.setEntitySets(entitySets);

    List<AssociationSet> associationSets = new ArrayList<>();
    associationSets.add(getAssociationSet(ENTITY_CONTAINER, ASSOCIATION_CAR_MANUFACTURER, ENTITY_SET_NAME_MANUFACTURERS, ROLE_1_2));
    entityContainer.setAssociationSets(associationSets);

    List<FunctionImport> functionImports = new ArrayList<>();
    functionImports.add(getFunctionImport(ENTITY_CONTAINER, FUNCTION_IMPORT));
    entityContainer.setFunctionImports(functionImports);

    entityContainers.add(entityContainer);
    schema.setEntityContainers(entityContainers);

    schemas.add(schema);

    return schemas;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:45,代码来源:MyEdmProvider.java


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