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


Java EdmPrimitiveTypeKind类代码示例

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


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

示例1: test_JpaEntityCsdlProvider_mapsActions

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
@Test
public void test_JpaEntityCsdlProvider_mapsActions() throws CsdlExtractException {

    // GIVEN
    final TestCsdlNestedEntityProvider sut = new TestCsdlNestedEntityProvider();

    // WHEN + THEN
    assertThat(sut.getCsdlActions()).hasSize(1);
    assertThat(sut.getCsdlActions().get(0).getParameters()).hasSize(3);
    assertThat(sut.getCsdlActions().get(0).getParameters().get(0).getName())
            .isEqualTo(CsdlProvider.BINDING_PARAM_NAME);
    assertThat(sut.getCsdlActions().get(0).getParameters().get(1).getTypeFQN())
            .isEqualTo(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
    assertThat(sut.getCsdlActions().get(0).getParameters().get(2).getTypeFQN())
            .isEqualTo(EdmPrimitiveTypeKind.String.getFullQualifiedName());
}
 
开发者ID:mat3e,项目名称:olingo-jpa,代码行数:17,代码来源:JpaEntityCsdlProviderTest.java

示例2: getPropertyType

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
/**
 * Get {@link FullQualifiedName} property type by value type.
 * 
 * @param value
 *            value
 * @return property type
 */
public static FullQualifiedName getPropertyType(Object value) {
    FullQualifiedName fqn = null;
    if (value instanceof String) {
        fqn = EdmPrimitiveTypeKind.String.getFullQualifiedName();
    } else if (value instanceof Byte) {
        fqn = EdmPrimitiveTypeKind.Byte.getFullQualifiedName();
    } else if (value instanceof Short) {
        fqn = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
    } else if (value instanceof Integer) {
        fqn = EdmPrimitiveTypeKind.Int32.getFullQualifiedName();
    } else if (value instanceof Long) {
        fqn = EdmPrimitiveTypeKind.Int64.getFullQualifiedName();
    } else if (value instanceof Double) {
        fqn = EdmPrimitiveTypeKind.Double.getFullQualifiedName();
    } else if (value instanceof Boolean) {
        fqn = EdmPrimitiveTypeKind.Boolean.getFullQualifiedName();
    } else if (value instanceof Date) {
        fqn = EdmPrimitiveTypeKind.Date.getFullQualifiedName();
    } else {
        throw new ODataRuntimeException("Property type is not supported.");
    }
    return fqn;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:31,代码来源:SerializeUtils.java

示例3: getEntityType

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

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

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

	return entityType;
}
 
开发者ID:rohitghatol,项目名称:spring-boot-Olingo-oData,代码行数:25,代码来源:ProductEntityProvider.java

示例4: getEntityType

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

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

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

	return entityType;
}
 
开发者ID:rohitghatol,项目名称:spring-boot-Olingo-oData,代码行数:24,代码来源:CategoryEntityProvider.java

示例5: buildPropery

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
static PropertyImpl buildPropery(String propName,
        EdmPrimitiveTypeKind type, Object value,
        String invalidCharacterReplacement) throws TransformationException,
        SQLException, IOException {

    if (value instanceof Array) {
        value = ((Array) value).getArray();

        int length = java.lang.reflect.Array.getLength(value);
        ArrayList values = new ArrayList();
        for (int i = 0; i < length; i++) {
            Object o = java.lang.reflect.Array.get(value, i);
            Object p = getPropertyValue(type, o, invalidCharacterReplacement);
            values.add(p);
        }
        return createCollection(propName, type, values);
    }
    return createPrimitive(propName, type, getPropertyValue(type, value, invalidCharacterReplacement));
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:20,代码来源:EntityList.java

示例6: getPropertyValue

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
static Object getPropertyValue(EdmPrimitiveTypeKind expectedType,
        Object value, String invalidCharacterReplacement)
        throws TransformationException, SQLException, IOException {
    if (value == null) {
        return null;
    }
    Class<?> sourceType = DataTypeManager.getRuntimeType(value.getClass());
    Class<?> targetType = DataTypeManager.getDataTypeClass(ODataTypeManager.teiidType(expectedType));
    if (sourceType != targetType) {
        Transform t = DataTypeManager.getTransform(sourceType, targetType);
        if (t == null && BlobType.class == targetType) {
            if (sourceType == ClobType.class) {
                return ClobType.getString((Clob) value).getBytes();
            }
            if (sourceType == SQLXML.class) {
                return ((SQLXML) value).getString().getBytes();
            }
        }
        value = t != null ? t.transform(value, targetType) : value;
        value = replaceInvalidCharacters(expectedType, value, invalidCharacterReplacement);
        return value;
    }
    value = replaceInvalidCharacters(expectedType, value, invalidCharacterReplacement);
    return value;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:26,代码来源:EntityList.java

示例7: getEntityType

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

示例8: getEntityType

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

示例9: getActions

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
@Override
public List<CsdlAction> getActions(final FullQualifiedName actionName) {
  if(actionName.equals(ACTION_RESET_FQN)) {
    // It is allowed to overload actions, so we have to provide a list of Actions for each action name
    final List<CsdlAction> actions = new ArrayList<CsdlAction>();
    
    // Create parameters
    final List<CsdlParameter> parameters = new ArrayList<CsdlParameter>();
    final CsdlParameter parameter = new CsdlParameter();
    parameter.setName(PARAMETER_AMOUNT);
    parameter.setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
    parameters.add(parameter);
    
    // Create the Csdl Action
    final CsdlAction action = new CsdlAction();
    action.setName(ACTION_RESET_FQN.getName());
    action.setParameters(parameters);
    actions.add(action);
    
    return actions;
  }
  
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:25,代码来源:DemoEdmProvider.java

示例10: buildTypeInfo

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
private EdmTypeInfo buildTypeInfo(final FullQualifiedName typeName, final String propertyType) {
  EdmTypeInfo typeInfo = null;
  if (typeName == null) {
    if (propertyType != null) {
      typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
    }
  } else {
    if (propertyType == null || propertyType.equals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString())) {
      typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
    } else if(isPrimiteveType(typeName)) {
      // Inheritance is not allowed for primitive types, so we use the type given by the EDM.
      typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
    } else {
      typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
    }
  }
  return typeInfo;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:ODataBinderImpl.java

示例11: primitiveCollectionAction

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
@Test
public void primitiveCollectionAction() throws Exception {
  Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  parameters.put("ParameterInt16", getFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
  parameters.put("ParameterDuration", getFactory().newPrimitiveValueBuilder()
      .setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
  final ODataInvokeResponse<ClientProperty> response =
      callAction("AIRTCollStringTwoParam", ClientProperty.class, parameters, false);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  ClientCollectionValue<ClientValue> valueArray = response.getBody().getCollectionValue();
  assertEquals(3, valueArray.size());
  Iterator<ClientValue> iterator = valueArray.iterator();
  assertEquals("UARTCollStringTwoParam duration value: PT1S", iterator.next().asPrimitive().toValue());
  assertEquals("UARTCollStringTwoParam duration value: PT2S", iterator.next().asPrimitive().toValue());
  assertEquals("UARTCollStringTwoParam duration value: PT3S", iterator.next().asPrimitive().toValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:ActionImportITCase.java

示例12: entityCollectionActionETAllPrim

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
@Test
public void entityCollectionActionETAllPrim() throws Exception {
  Calendar time = Calendar.getInstance();
  time.clear();
  time.set(Calendar.HOUR_OF_DAY, 3);
  time.set(Calendar.MINUTE, 0);
  time.set(Calendar.SECOND, 0);
  Map<String, ClientValue> parameters = Collections.singletonMap(
      "ParameterTimeOfDay",
      (ClientValue) getFactory().newPrimitiveValueBuilder()
          .setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(time).build());
  final ODataInvokeResponse<ClientEntitySet> response =
      callAction("AIRTCollESAllPrimParam", ClientEntitySet.class, parameters, false);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  ClientEntitySet entitySet = response.getBody();
  assertEquals(3, entitySet.getEntities().size());
  Integer key = 1;
  for (ClientEntity entity : entitySet.getEntities()) {
    assertEquals(key, entity.getProperty("PropertyInt16").getPrimitiveValue().toValue());
    key++;
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:ActionImportITCase.java

示例13: multiLineString

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
    final EdmPrimitiveTypeKind type, final SRID srid) throws XMLStreamException {

  final List<LineString> lineStrings = new ArrayList<LineString>();

  boolean foundEndProperty = false;
  while (reader.hasNext() && !foundEndProperty) {
    final XMLEvent event = reader.nextEvent();

    if (event.isStartElement() && event.asStartElement().getName().equals(Constants.QNAME_LINESTRING)) {
      lineStrings.add(lineString(reader, event.asStartElement(), type, null));
    }

    if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
      foundEndProperty = true;
    }
  }

  return new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:AtomGeoValueDeserializer.java

示例14: getDimension

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
/**
 * Get dimension based on given Geography / Geometry type.
 *
 * @param type a geography / geometry type
 * @return dimension according to given geography / geometry type
 */
public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
  Geospatial.Dimension dimension;

  switch (type) {
  case Geography:
  case GeographyCollection:
  case GeographyLineString:
  case GeographyMultiLineString:
  case GeographyPoint:
  case GeographyMultiPoint:
  case GeographyPolygon:
  case GeographyMultiPolygon:
    dimension = Geospatial.Dimension.GEOGRAPHY;
    break;

  default:
    dimension = Geospatial.Dimension.GEOMETRY;
  }

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

示例15: geoMultiPolygon

import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; //导入依赖的package包/类
@Test
public void geoMultiPolygon() throws Exception {
  final EdmEntityType entityType = mockEntityType(EdmPrimitiveTypeKind.GeometryMultiPolygon);
  final Entity entity = new Entity()
      .addProperty(new Property(null, entityType.getPropertyNames().get(0), ValueType.GEOSPATIAL,
          new MultiPolygon(Dimension.GEOMETRY, null, Arrays.asList(
              new Polygon(Dimension.GEOMETRY, null,
                  Arrays.asList(
                      createPoint(1, 1), createPoint(1, 2), createPoint(2, 2), createPoint(2, 1), createPoint(1, 1)),
                  Arrays.asList(
                      createPoint(0, 0), createPoint(3, 0), createPoint(3, 3), createPoint(0, 3),
                      createPoint(0, 0))),
              new Polygon(Dimension.GEOMETRY, null,
                  Arrays.asList(
                      createPoint(10, 10), createPoint(10, 20), createPoint(20, 10), createPoint(10, 10)),
                  Arrays.asList(
                      createPoint(0, 0), createPoint(30, 0), createPoint(0, 30), createPoint(0, 0)))))));
  Assert.assertEquals("{\"" + entityType.getPropertyNames().get(0) + "\":{"
      + "\"type\":\"MultiPolygon\",\"coordinates\":["
      + "[[[0.0,0.0],[3.0,0.0],[3.0,3.0],[0.0,3.0],[0.0,0.0]],"
      + "[[1.0,1.0],[1.0,2.0],[2.0,2.0],[2.0,1.0],[1.0,1.0]]],"
      + "[[[0.0,0.0],[30.0,0.0],[0.0,30.0],[0.0,0.0]],"
      + "[[10.0,10.0],[10.0,20.0],[20.0,10.0],[10.0,10.0]]]]}}",
      IOUtils.toString(serializerNoMetadata.entity(metadata, entityType, entity, null).getContent()));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:ODataJsonSerializerv01Test.java


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