• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CsdlProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



CsdlProperty类属于org.apache.olingo.commons.api.edm.provider包,在下文中一共展示了CsdlProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeProperties

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Override
protected void writeProperties(ServiceMetadata metadata, EdmStructuredType type,
        List<Property> properties, SelectOption select, JsonGenerator json)
        throws IOException, SerializerException {
    boolean all = ExpandSelectHelper.isAll(select);
    Set<String> selected = all ? new HashSet<>()
            : ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems());
    for (Property property : properties) {
        String propertyName = property.getName();
        if (all || selected.contains(propertyName)) {
            EdmProperty edmProperty = type.getStructuralProperty(propertyName);
            if (edmProperty == null) {
                edmProperty = new EdmPropertyImpl(metadata.getEdm(), new CsdlProperty()
                        .setType(getPropertyType(property.getValue())).setName(propertyName));
            }
            Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null
                    : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(),
                            propertyName);
            writeProperty(metadata, edmProperty, property, selectedPaths, json);
        }
    }
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:23,代码来源:ElasticODataJsonSerializer.java


示例2: writeProperties

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Override
protected void writeProperties(ServiceMetadata metadata, EdmStructuredType type,
        List<Property> properties, SelectOption select, String xml10InvalidCharReplacement,
        XMLStreamWriter writer) throws XMLStreamException, SerializerException {
    boolean all = ExpandSelectHelper.isAll(select);
    Set<String> selected = all ? new HashSet<>()
            : ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems());
    for (Property property : properties) {
        String propertyName = property.getName();
        if (all || selected.contains(propertyName)) {
            EdmProperty edmProperty = type.getStructuralProperty(propertyName);
            if (edmProperty == null) {
                edmProperty = new EdmPropertyImpl(metadata.getEdm(), new CsdlProperty()
                        .setType(getPropertyType(property.getValue())).setName(propertyName));
            }
            Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null
                    : ExpandSelectHelper.getSelectedPaths(select.getSelectItems(),
                            propertyName);
            writeProperty(metadata, edmProperty, property, selectedPaths,
                    xml10InvalidCharReplacement, writer);
        }
    }
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:24,代码来源:ElasticODataXmlSerializer.java


示例3: getComplexTypes

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
/**
 * Get's complex types for specific Elasticsearch index.
 * 
 * @param index
 *            index name
 * @return list of complex types
 * @throws ODataException
 *             if any error occurred
 */
public List<ElasticCsdlComplexType> getComplexTypes(String index) throws ODataException {
    Map<ElasticCsdlComplexType, Set<CsdlProperty>> complexMappings = new HashMap<>();
    for (ObjectCursor<String> key : mappingMetaDataProvider.getAllMappings(index).keys()) {
        String type = key.value;
        ParsedMapWrapper typeProperties = getTypeProperties(index, type);
        for (String field : typeProperties.getMap().keySet()) {
            ParsedMapWrapper fieldMap = typeProperties.mapValue(field);
            if (isNested(fieldMap.stringValue(FIELD_DATATYPE_PROPERTY))) {
                ParsedMapWrapper properties = fieldMap.mapValue(PROPERTIES_PROPERTY);
                createComplexTypes(index, type, field, properties).entrySet().stream()
                        .forEach(e -> getAndPut(complexMappings, e.getKey(), e.getValue()));
            }
        }
    }
    List<ElasticCsdlComplexType> complexTypes = new ArrayList<>();
    for (Entry<ElasticCsdlComplexType, Set<CsdlProperty>> entry : complexMappings.entrySet()) {
        ElasticCsdlComplexType complexType = entry.getKey();
        complexType.setProperties(new ArrayList<>(entry.getValue()));
        complexTypes.add(complexType);
    }
    return complexTypes;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:32,代码来源:AbstractNestedTypeMapper.java


示例4: getProperties_TypeNameAndCorrectMetaData_ListOfCsdlPropertiesRetrieved

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void getProperties_TypeNameAndCorrectMetaData_ListOfCsdlPropertiesRetrieved()
        throws IOException, ODataException {
    MultyElasticIndexCsdlEdmProvider edmProvider = new MultyElasticIndexCsdlEdmProvider(
            metaDataProvider, indices, nestedTypeMapper);
    List<CsdlProperty> csdlProperties = edmProvider.getProperties(AUTHORS_INDEX, AUTHOR_TYPE,
            getStubProperties());
    assertEquals(2, csdlProperties.size());
    for (CsdlProperty property : csdlProperties) {
        assertTrue(property instanceof ElasticCsdlProperty);
        assertEquals(AUTHORS_INDEX, ((ElasticCsdlProperty) property).getESIndex());
        assertEquals(AUTHOR_TYPE, ((ElasticCsdlProperty) property).getESType());
        assertEquals(property.getName(), ((ElasticCsdlProperty) property).getESField());
        assertNotNull(property.getTypeAsFQNObject());
    }
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:17,代码来源:MultyElasticIndexCsdlEdmProviderTest.java


示例5: createEntityType_IndexAndTypeWithCustomIdProperty_EntityTypeRetrived

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void createEntityType_IndexAndTypeWithCustomIdProperty_EntityTypeRetrived()
        throws ODataException, IOException {
    MultyElasticIndexCsdlEdmProvider edmProvider = spy(
            new MultyElasticIndexCsdlEdmProvider(metaDataProvider, indices));
    MappingMetaData metaData = mock(MappingMetaData.class);
    when(metaDataProvider.getMappingForType(AUTHORS_INDEX, AUTHOR_TYPE)).thenReturn(metaData);
    doReturn(new ArrayList<>()).when(edmProvider).getProperties(AUTHORS_INDEX, AUTHOR_TYPE,
            metaData);
    doReturn(new ArrayList<>()).when(edmProvider).getNavigationProperties(AUTHORS_INDEX,
            AUTHOR_TYPE);
    ElasticCsdlEntityType entityType = edmProvider.createEntityType(AUTHORS_INDEX, AUTHOR_TYPE);
    assertTrue(entityType instanceof ElasticCsdlEntityType);
    assertEquals(AUTHORS_INDEX, ((ElasticCsdlEntityType) entityType).getESIndex());
    assertEquals(AUTHOR_TYPE, ((ElasticCsdlEntityType) entityType).getESType());
    List<CsdlProperty> properties = entityType.getProperties();
    assertEquals(1, properties.size());
    CsdlProperty idProperty = properties.get(0);
    assertEquals(ElasticConstants.ID_FIELD_NAME, idProperty.getName());
    List<CsdlPropertyRef> keys = entityType.getKey();
    assertEquals(1, keys.size());
    CsdlPropertyRef idRef = keys.get(0);
    assertEquals(ElasticConstants.ID_FIELD_NAME, idRef.getName());
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:25,代码来源:MultyElasticIndexCsdlEdmProviderTest.java


示例6: getEntityType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType() {

  // create EntityType properties
  CsdlProperty id = new CsdlProperty().setName("CID")
      .setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
  CsdlProperty name = new CsdlProperty().setName("CName")
      .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
  CsdlProperty description = new CsdlProperty().setName("CDescription")
      .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());

  // create CsdlPropertyRef for Key element
  CsdlPropertyRef propertyRef = new CsdlPropertyRef();

  propertyRef.setName("ID");

  // configure EntityType
  CsdlEntityType entityType = new CsdlEntityType();

  entityType.setName(ET_COMPUTER_SYSTEM_NAME);
  entityType.setProperties(Arrays.asList(id, name, description));
  entityType.setKey(Collections.singletonList(propertyRef));

  return entityType;
}
 
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:26,代码来源:RedHxComputerSystemServiceEdmProvider.java


示例7: getEntityType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
/**
 *
 *
 * @return
 */
@Override
public CsdlEntityType getEntityType() {
  // create EntityType properties
  CsdlProperty id =
      new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
  CsdlProperty name = new CsdlProperty().setName("Name")
      .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
  CsdlProperty description = new CsdlProperty().setName("Description")
      .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());

  // create CsdlPropertyRef for Key element
  CsdlPropertyRef propertyRef = new CsdlPropertyRef();

  propertyRef.setName("ID");

  // configure EntityType
  CsdlEntityType entityType = new CsdlEntityType();

  entityType.setName(ET_CHASSIS_NAME);
  entityType.setProperties(Arrays.asList(id, name, description));
  entityType.setKey(Collections.singletonList(propertyRef));

  return entityType;
}
 
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:30,代码来源:RedHxChassisServiceEdmProvider.java


示例8: isComplexPreviousTypeCompatibleToBindingParam

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
/**
 * @param bindingParameterTypeName
 * @param parameter 
 * @param isBindingParameterCollection 
 * @return
 * @throws ODataException
 */
private boolean isComplexPreviousTypeCompatibleToBindingParam(
    final FullQualifiedName bindingParameterTypeName, final CsdlParameter parameter, 
    Boolean isBindingParameterCollection)
    throws ODataException {
  CsdlComplexType complexType = provider.getComplexType(bindingParameterTypeName);
  if(provider.getEntityType(parameter.getTypeFQN()) == null){
    return false;
  }
  List<CsdlProperty> properties = provider.getEntityType(parameter.getTypeFQN()).getProperties();
  for (CsdlProperty property : properties) {
    String paramPropertyTypeName = property.getTypeAsFQNObject().getFullQualifiedNameAsString();
    if ((complexType != null && complexType.getBaseType() != null && 
        complexType.getBaseTypeFQN().getFullQualifiedNameAsString().equals(paramPropertyTypeName)) || 
        paramPropertyTypeName.equals(bindingParameterTypeName.getFullQualifiedNameAsString()) && 
        isBindingParameterCollection.booleanValue() == property.isCollection()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:28,代码来源:EdmProviderImpl.java


示例9: getTypeReturnsComplexType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void getTypeReturnsComplexType() throws Exception {
  CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
  EdmProviderImpl edm = new EdmProviderImpl(provider);
  final FullQualifiedName complexTypeName = new FullQualifiedName("ns", "complex");
  CsdlComplexType complexTypeProvider = new CsdlComplexType();
  when(provider.getComplexType(complexTypeName)).thenReturn(complexTypeProvider);
  CsdlProperty propertyProvider = new CsdlProperty();
  propertyProvider.setType(complexTypeName);
  final EdmProperty property = new EdmPropertyImpl(edm, propertyProvider);
  assertFalse(property.isCollection());
  assertFalse(property.isPrimitive());
  final EdmType type = property.getType();
  assertEquals(EdmTypeKind.COMPLEX, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("complex", type.getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:EdmPropertyImplTest.java


示例10: getTypeReturnsEnumType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void getTypeReturnsEnumType() throws Exception {
  CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
  EdmProviderImpl edm = new EdmProviderImpl(provider);
  final FullQualifiedName enumTypeName = new FullQualifiedName("ns", "enum");
  CsdlEnumType enumTypeProvider = new CsdlEnumType();
  when(provider.getEnumType(enumTypeName)).thenReturn(enumTypeProvider);
  CsdlProperty propertyProvider = new CsdlProperty();
  propertyProvider.setType(enumTypeName);
  final EdmProperty property = new EdmPropertyImpl(edm, propertyProvider);
  assertFalse(property.isCollection());
  assertFalse(property.isPrimitive());
  final EdmType type = property.getType();
  assertEquals(EdmTypeKind.ENUM, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("enum", type.getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:EdmPropertyImplTest.java


示例11: getTypeReturnsTypeDefinition

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void getTypeReturnsTypeDefinition() throws Exception {
  CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
  EdmProviderImpl edm = new EdmProviderImpl(provider);
  final FullQualifiedName typeName = new FullQualifiedName("ns", "definition");
  CsdlTypeDefinition typeProvider =
      new CsdlTypeDefinition().setUnderlyingType(new FullQualifiedName("Edm", "String"));
  when(provider.getTypeDefinition(typeName)).thenReturn(typeProvider);
  CsdlProperty propertyProvider = new CsdlProperty();
  propertyProvider.setType(typeName);
  final EdmProperty property = new EdmPropertyImpl(edm, propertyProvider);
  assertFalse(property.isPrimitive());
  final EdmType type = property.getType();
  assertEquals(EdmTypeKind.DEFINITION, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("definition", type.getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:EdmPropertyImplTest.java


示例12: facets

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void facets() {
  EdmProviderImpl edm = new EdmProviderImpl(mock(CsdlEdmProvider.class));
  CsdlProperty propertyProvider = new CsdlProperty();
  propertyProvider.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
  propertyProvider.setPrecision(42);
  propertyProvider.setScale(12);
  propertyProvider.setMaxLength(128);
  propertyProvider.setUnicode(true);
  propertyProvider.setNullable(false);
  propertyProvider.setDefaultValue("x");
  final EdmProperty property = new EdmPropertyImpl(edm, propertyProvider);
  assertTrue(property.isPrimitive());
  assertNull(property.getMapping());
  assertNull(property.getMimeType());
  assertEquals(Integer.valueOf(42), property.getPrecision());
  assertEquals(Integer.valueOf(12), property.getScale());
  assertEquals(Integer.valueOf(128), property.getMaxLength());
  assertTrue(property.isUnicode());
  assertFalse(property.isNullable());
  assertEquals("x", property.getDefaultValue());
  assertNull(property.getSrid());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:24,代码来源:EdmPropertyImplTest.java


示例13: initialMappingMustBeNull

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void initialMappingMustBeNull() {
  CsdlProperty property = new CsdlProperty().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName());
  EdmProperty edmProperty = new EdmPropertyImpl(null, property);
  assertNull(edmProperty.getMapping());

  CsdlParameter parameter = new CsdlParameter().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName());
  EdmParameter edmParameter = new EdmParameterImpl(null, parameter);
  assertNull(edmParameter.getMapping());

  CsdlEntitySet es = new CsdlEntitySet().setName("test");
  EdmEntitySet edmES = new EdmEntitySetImpl(null, null, es);
  assertNull(edmES.getMapping());

  CsdlSingleton si = new CsdlSingleton().setName("test");
  EdmSingleton edmSi = new EdmSingletonImpl(null, null, si);
  assertNull(edmSi.getMapping());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:EdmMappingTest.java


示例14: getInternalNameViaMapping

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
public void getInternalNameViaMapping() {
  CsdlMapping mapping = new CsdlMapping().setInternalName("internalName");

  CsdlProperty property =
      new CsdlProperty().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName()).setMapping(mapping);
  EdmProperty edmProperty = new EdmPropertyImpl(null, property);
  assertNotNull(edmProperty.getMapping());
  assertEquals("internalName", edmProperty.getMapping().getInternalName());

  CsdlParameter parameter =
      new CsdlParameter().setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName()).setMapping(mapping);
  EdmParameter edmParameter = new EdmParameterImpl(null, parameter);
  assertNotNull(edmParameter.getMapping());
  assertEquals("internalName", edmParameter.getMapping().getInternalName());

  CsdlEntitySet es = new CsdlEntitySet().setName("test").setMapping(mapping);
  EdmEntitySet edmES = new EdmEntitySetImpl(null, null, es);
  assertNotNull(edmES.getMapping());
  assertEquals("internalName", edmES.getMapping().getInternalName());

  CsdlSingleton si = new CsdlSingleton().setName("test").setMapping(mapping);
  EdmSingleton edmSi = new EdmSingletonImpl(null, null, si);
  assertNotNull(edmSi.getMapping());
  assertEquals("internalName", edmSi.getMapping().getInternalName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:EdmMappingTest.java


示例15: getDataClassForPrimTypeViaMapping

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void getDataClassForPrimTypeViaMapping() {
  CsdlMapping mapping = new CsdlMapping().setMappedJavaClass(Date.class);
  CsdlProperty property = new CsdlProperty()
      .setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName())
      .setMapping(mapping);
  EdmProperty edmProperty = new EdmPropertyImpl(null, property);

  assertNotNull(edmProperty.getMapping());
  assertEquals(Date.class, edmProperty.getMapping().getMappedJavaClass());

  CsdlParameter parameter = new CsdlParameter()
      .setType(EdmPrimitiveTypeKind.DateTimeOffset.getFullQualifiedName())
      .setMapping(mapping);
  EdmParameter edmParameter = new EdmParameterImpl(null, parameter);

  assertNotNull(edmParameter.getMapping());
  assertEquals(Date.class, edmParameter.getMapping().getMappedJavaClass());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:EdmMappingTest.java


示例16: readEntityType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
private void readEntityType(XMLEventReader reader, StartElement element, CsdlSchema schema)
    throws XMLStreamException {
  CsdlEntityType entityType = new CsdlEntityType();
  entityType.setProperties(new ArrayList<CsdlProperty>());
  entityType.setNavigationProperties(new ArrayList<CsdlNavigationProperty>());
  entityType.setKey(new ArrayList<CsdlPropertyRef>());
  entityType.setName(attr(element, "Name"));
  if (attr(element, "BaseType") != null) {
    entityType.setBaseType(new FullQualifiedName(attr(element, "BaseType")));
  }
  entityType.setAbstract(Boolean.parseBoolean(attr(element, "Abstract")));
  entityType.setOpenType(Boolean.parseBoolean(attr(element, "OpenType")));
  entityType.setHasStream(Boolean.parseBoolean(attr(element, "HasStream")));
  readEntityProperties(reader, entityType);
  schema.getEntityTypes().add(entityType);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:MetadataParser.java


示例17: testComplexType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Test
public void testComplexType() throws ODataException {
  // Test Complex Type
  CsdlComplexType ct = provider.getComplexType(new FullQualifiedName(NS, "City"));
  assertNotNull(ct);
  assertEquals(3, ct.getProperties().size());
  CsdlProperty p = ct.getProperties().get(0);
  assertEquals("CountryRegion", p.getName());
  assertEquals("Edm.String", p.getType());
  assertFalse(p.isNullable());

  ct = provider.getComplexType(new FullQualifiedName(NS, "Location"));
  assertNotNull(ct);

  ct = provider.getComplexType(new FullQualifiedName(NS, "EventLocation"));
  assertNotNull(ct);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:MetadataParserTest.java


示例18: getEntityType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
  // this method is called for one of the EntityTypes that are configured in the Schema
  if(ET_PRODUCT_FQN.equals(entityTypeName)){

    //create EntityType properties
    CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
    CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
    CsdlProperty  description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());

    // create PropertyRef for Key element
    CsdlPropertyRef propertyRef = new CsdlPropertyRef();
    propertyRef.setName("ID");

    // configure EntityType
    CsdlEntityType entityType = new CsdlEntityType();
    entityType.setName(ET_PRODUCT_NAME);
    entityType.setProperties(Arrays.asList(id, name, description));
    entityType.setKey(Collections.singletonList(propertyRef));

    return entityType;
  }

  return null;

}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoEdmProvider.java


示例19: getEntityType

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {

  // this method is called for one of the EntityTypes that are configured in the Schema
  if(entityTypeName.equals(ET_PRODUCT_FQN)){

    //create EntityType properties
    CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
    CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
    CsdlProperty  description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());

    // create CsdlPropertyRef for Key element
    CsdlPropertyRef propertyRef = new CsdlPropertyRef();
    propertyRef.setName("ID");

    // configure EntityType
    CsdlEntityType entityType = new CsdlEntityType();
    entityType.setName(ET_PRODUCT_NAME);
    entityType.setProperties(Arrays.asList(id, name , description));
    entityType.setKey(Collections.singletonList(propertyRef));

    return entityType;
  }

  return null;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoEdmProvider.java


示例20: EDMProvider

import org.apache.olingo.commons.api.edm.provider.CsdlProperty; //导入依赖的package包/类
public EDMProvider(List<String> tableList, String containerName, String namespace,
                   Map<String, List<CsdlProperty>> propertiesMap, Map<String, List<CsdlPropertyRef>> pkeys,
                   List<String> entitySet, Map<String, NavigationTable> navigationProperties) {
    this.containerFullQName = new FullQualifiedName(namespace, containerName);
    this.namespace = namespace;
    if (navigationProperties != null) {
        this.manyToOneRelationList = generateManyToOneRelationships(navigationProperties);
        this.oneToManyRelationList = generateOneToManyRelationships(navigationProperties);
    } else {
        this.manyToOneRelationList = null;
        this.oneToManyRelationList = null;
    }
    this.csdlEntityTypesMap = generateEntityTypes(propertiesMap, tableList, pkeys);
    this.csdlEntitySetMap = generateEntitySets(entitySet);
    this.csdlEntityContainer = generateCsdlEntityContainer();
    this.csdlEntityContainerInfo = generateCsdlEntityContainerInfo();
    this.csdlSchemaList = generateSchemaList();
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:19,代码来源:EDMProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReducerFactory类代码示例发布时间:2022-05-22
下一篇:
Java LaunchOptions类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap