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


Java EdmTypeKind类代码示例

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


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

示例1: createPropertyList

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Property createPropertyList(String name, List<Object> valueObject,
        EdmStructuredType structuredType) {
    ValueType valueType;
    EdmElement property = structuredType.getProperty(name);
    EdmTypeKind propertyKind = property.getType().getKind();
    if (propertyKind == EdmTypeKind.COMPLEX) {
        valueType = ValueType.COLLECTION_COMPLEX;
    } else {
        valueType = ValueType.COLLECTION_PRIMITIVE;
    }
    List<Object> properties = new ArrayList<>();
    for (Object value : valueObject) {
        if (value instanceof Map) {
            properties.add(createComplexValue((Map<String, Object>) value, property));
        } else {
            properties.add(value);
        }
    }
    return new Property(null, name, valueType, properties);
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:22,代码来源:PropertyCreator.java

示例2: createComplexValue

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
private ComplexValue createComplexValue(final EdmProperty edmProperty,
    final ComplexValue complexValue, final boolean patch) throws DataProviderException {
  final ComplexValue result = new ComplexValue();
  final EdmComplexType edmType = (EdmComplexType) edmProperty.getType();
  final List<Property> givenProperties = complexValue.getValue();

  // Create ALL properties, even if no value is given. Check if null is allowed
  for (final String propertyName : edmType.getPropertyNames()) {
    final EdmProperty innerEdmProperty = (EdmProperty) edmType.getProperty(propertyName);
    final Property currentProperty = findProperty(propertyName, givenProperties);
    final Property newProperty = createProperty(innerEdmProperty, propertyName);
    result.getValue().add(newProperty);

    if (currentProperty != null) {
      updateProperty(innerEdmProperty, newProperty, currentProperty, patch);
    } else if (innerEdmProperty.isNullable()) {
      // Check complex properties ... may be null is not allowed
      if (edmProperty.getType().getKind() == EdmTypeKind.COMPLEX) {
        updateProperty(innerEdmProperty, newProperty, null, patch);
      }
    }
  }

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

示例3: createProperty

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
private Property createProperty(final EdmProperty edmProperty, final String propertyName)
    throws DataProviderException {
  final EdmType type = edmProperty.getType();
  Property newProperty;
  if (edmProperty.isPrimitive()
      || type.getKind() == EdmTypeKind.ENUM || type.getKind() == EdmTypeKind.DEFINITION) {
    newProperty = edmProperty.isCollection() ?
        DataCreator.createPrimitiveCollection(propertyName) :
        DataCreator.createPrimitive(propertyName, null);
  } else {
    if (edmProperty.isCollection()) {
      @SuppressWarnings("unchecked")
      Property newProperty2 = DataCreator.createComplexCollection(propertyName, 
          edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString());
      newProperty = newProperty2;
    } else {
      newProperty = DataCreator.createComplex(propertyName,
          edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString());
      createProperties((EdmComplexType) type, newProperty.asComplex().getValue());
    }
  }
  return newProperty;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:24,代码来源:DataProvider.java

示例4: getContextUrl

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
private ContextURL getContextUrl(final EdmEntitySet entitySet, final Entity entity, final List<String> path,
    final EdmType type, final RepresentationType representationType,
    final ExpandOption expand, final SelectOption select) throws ODataLibraryException {
  final UriHelper helper = odata.createUriHelper();
  Builder builder = ContextURL.with();
  builder = entitySet == null ?
      representationType == RepresentationType.PRIMITIVE || representationType == RepresentationType.COMPLEX ?
          builder.type(type) :
          builder.type(type).asCollection() :
      builder.entitySet(entitySet).keyPath(helper.buildKeyPredicate(entitySet.getEntityType(), entity));
  if (entitySet != null && !path.isEmpty()) {
    builder = builder.navOrPropertyPath(buildPropertyPath(path));
  }
  builder = builder.selectList(
      type.getKind() == EdmTypeKind.PRIMITIVE
          || type.getKind() == EdmTypeKind.ENUM
          || type.getKind() == EdmTypeKind.DEFINITION ?
              null :
              helper.buildContextURLSelectList((EdmStructuredType) type, expand, select));
  return builder.build();
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:TechnicalPrimitiveComplexProcessor.java

示例5: EdmEnumTypeImpl

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final CsdlEnumType enumType) {
  super(edm, enumName, EdmTypeKind.ENUM, enumType);

  if (enumType.getUnderlyingType() == null) {
    underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
  } else {
    final EdmPrimitiveTypeKind underlyingTypeKind = EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType());
    if (underlyingTypeKind == EdmPrimitiveTypeKind.Byte
        || underlyingTypeKind == EdmPrimitiveTypeKind.SByte
        || underlyingTypeKind == EdmPrimitiveTypeKind.Int16
        || underlyingTypeKind == EdmPrimitiveTypeKind.Int32
        || underlyingTypeKind == EdmPrimitiveTypeKind.Int64) {
      underlyingType = EdmPrimitiveTypeFactory.getInstance(underlyingTypeKind);
    } else {
      throw new EdmException("Not allowed as underlying type: " + underlyingTypeKind);
    }
  }

  this.enumType = enumType;
  this.enumName = enumName;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:EdmEnumTypeImpl.java

示例6: navigationProperty

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
@Test
public void navigationProperty() throws Exception {
  CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
  EdmProviderImpl edm = new EdmProviderImpl(provider);
  final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
  CsdlEntityType entityTypeProvider = new CsdlEntityType();
  entityTypeProvider.setKey(Collections.<CsdlPropertyRef> emptyList());
  when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
  CsdlNavigationProperty propertyProvider = new CsdlNavigationProperty();
  propertyProvider.setType(entityTypeName);
  propertyProvider.setNullable(false);
  EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, propertyProvider);
  assertFalse(property.isCollection());
  assertFalse(property.isNullable());
  EdmType type = property.getType();
  assertEquals(EdmTypeKind.ENTITY, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("entity", type.getName());
  assertNull(property.getReferencingPropertyName("referencedPropertyName"));
  assertNull(property.getPartner());
  assertFalse(property.containsTarget());

  // Test caching
  EdmType cachedType = property.getType();
  assertTrue(type == cachedType);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:EdmNavigationPropertyImplTest.java

示例7: getTypeReturnsComplexType

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的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

示例8: getTypeReturnsEnumType

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的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

示例9: getTypeReturnsTypeDefinition

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的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

示例10: getTypeReturnsComplexType

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的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);
  CsdlParameter parameterProvider = new CsdlParameter();
  parameterProvider.setType(complexTypeName);
  final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
  assertFalse(parameter.isCollection());
  final EdmType type = parameter.getType();
  assertEquals(EdmTypeKind.COMPLEX, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("complex", type.getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmParameterImplTest.java

示例11: getTypeReturnsEnumType

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的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);
  CsdlParameter parameterProvider = new CsdlParameter();
  parameterProvider.setType(enumTypeName);
  final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
  assertFalse(parameter.isCollection());
  final EdmType type = parameter.getType();
  assertEquals(EdmTypeKind.ENUM, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("enum", type.getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmParameterImplTest.java

示例12: getTypeReturnsTypeDefinition

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的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);
  CsdlParameter parameterProvider = new CsdlParameter();
  parameterProvider.setType(typeName);
  final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
  final EdmType type = parameter.getType();
  assertEquals(EdmTypeKind.DEFINITION, type.getKind());
  assertEquals("ns", type.getNamespace());
  assertEquals("definition", type.getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmParameterImplTest.java

示例13: action1BasicMethodCalls

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
@Test
public void action1BasicMethodCalls() {
  assertTrue(actionImpl1.isBound());
  assertEquals(EdmTypeKind.ACTION, actionImpl1.getKind());
  assertNull(actionImpl1.getReturnType());
  // assertEquals("returnName", actionImpl1.getReturnType().getType().getName());
  assertNotNull(actionImpl1.getParameterNames());

  for (String name : actionImpl1.getParameterNames()) {
    EdmParameter parameter = actionImpl1.getParameter(name);
    assertNotNull(parameter);
    assertEquals(name, parameter.getName());
  }

  assertNull(actionImpl1.getReturnedEntitySet(null));
  assertNull(actionImpl1.getReturnedEntitySet(mock(EdmEntitySet.class)));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:EdmActionImplTest.java

示例14: action2BasicMethodCalls

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
@Test
public void action2BasicMethodCalls() {
  assertFalse(actionImpl2.isBound());
  assertEquals(EdmTypeKind.ACTION, actionImpl2.getKind());
  assertEquals("String", actionImpl2.getReturnType().getType().getName());
  assertNotNull(actionImpl2.getParameterNames());

  for (String name : actionImpl2.getParameterNames()) {
    EdmParameter parameter = actionImpl2.getParameter(name);
    assertNotNull(parameter);
    assertEquals(name, parameter.getName());
  }

  assertNull(actionImpl2.getReturnedEntitySet(null));
  assertNull(actionImpl2.getReturnedEntitySet(mock(EdmEntitySet.class)));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmActionImplTest.java

示例15: handleCountDispatching

import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; //导入依赖的package包/类
private void handleCountDispatching(final ODataRequest request, final ODataResponse response,
    final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
  final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
  if (resource instanceof UriResourceEntitySet
      || resource instanceof UriResourceNavigation
      || resource instanceof UriResourceFunction
          && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.ENTITY) {
    handler.selectProcessor(CountEntityCollectionProcessor.class)
        .countEntityCollection(request, response, uriInfo);
  } else if (resource instanceof UriResourcePrimitiveProperty
      || resource instanceof UriResourceFunction
          && ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
    handler.selectProcessor(CountPrimitiveCollectionProcessor.class)
        .countPrimitiveCollection(request, response, uriInfo);
  } else {
    handler.selectProcessor(CountComplexCollectionProcessor.class)
        .countComplexCollection(request, response, uriInfo);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:ODataDispatcher.java


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