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

Java EdmSimpleTypeKind类代码示例

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

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



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

示例1: getFunctionImport

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Override
public FunctionImport getFunctionImport()
{
   // Returns the Result Set of the given query as String.
   ReturnType rt = new ReturnType()
         .setMultiplicity(EdmMultiplicity.ZERO_TO_ONE)
         .setTypeName(EdmSimpleTypeKind.String.getFullQualifiedName());

   // One required param: the SPARQL query.
   List<FunctionImportParameter> params = new ArrayList<>();
   params.add(new FunctionImportParameter()
         .setName("query")
         .setType(EdmSimpleTypeKind.String)
         .setFacets(new Facets().setNullable(false)));

   return new FunctionImport()
         .setName(NAME)
         .setHttpMethod("GET")
         .setParameters(params)
         .setReturnType(rt);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:22,代码来源:Sparql.java


示例2: valueOfStringBoolean

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void valueOfStringBoolean() throws Exception {
  final EdmSimpleType instance = EdmSimpleTypeKind.Boolean.getEdmSimpleTypeInstance();

  assertEquals(true, instance.valueOfString("true", EdmLiteralKind.DEFAULT, null, Boolean.class));
  assertEquals(false, instance.valueOfString("false", EdmLiteralKind.JSON, null, Boolean.class));
  assertEquals(true, instance.valueOfString("1", EdmLiteralKind.URI, null, Boolean.class));
  assertEquals(false, instance.valueOfString("0", EdmLiteralKind.URI, null, Boolean.class));

  expectErrorInValueOfString(instance, "True", EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
  expectErrorInValueOfString(instance, "-1", EdmLiteralKind.JSON, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
  expectErrorInValueOfString(instance, "FALSE", EdmLiteralKind.URI, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);

  expectTypeErrorInValueOfString(instance, "1", EdmLiteralKind.DEFAULT);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:EdmSimpleTypeTest.java


示例3: buildSimpleProperty

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty,
    final JoinColumn joinColumn)
    throws ODataJPAModelException, ODataJPARuntimeException {

  boolean isForeignKey = joinColumn != null;
  JPAEdmNameBuilder.build(JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming, isForeignKey);
  EdmSimpleTypeKind simpleTypeKind = JPATypeConverter
      .convertToEdmSimpleType(jpaAttribute
          .getJavaType(), jpaAttribute);
  simpleProperty.setType(simpleTypeKind);
  Facets facets = JPAEdmFacets.createAndSet(jpaAttribute, simpleProperty);
  if(isForeignKey) {
    facets.setNullable(joinColumn.nullable());
  }

  return simpleProperty;

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPAEdmProperty.java


示例4: createKeyPredicates

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
private List<KeyPredicate> createKeyPredicates(final boolean toThrowException) throws EdmException {
  KeyPredicate keyPredicate = EasyMock.createMock(KeyPredicate.class);
  EasyMock.expect(keyPredicate.getLiteral()).andStubReturn("1");
  EdmProperty edmProperty = EasyMock.createMock(EdmProperty.class);
  JPAEdmMappingImpl edmMapping = EasyMock.createMock(JPAEdmMappingImpl.class);
  EasyMock.expect(edmMapping.getJPAType())
  .andStubReturn(null);
  EasyMock.expect(edmMapping.getInternalName()).andStubReturn("soid");
  EasyMock.expect(edmProperty.getMapping()).andStubReturn(edmMapping);
  EasyMock.expect(edmProperty.getName()).andStubReturn("soid");
  EdmSimpleType edmType = EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance();
  if (toThrowException) {
    EasyMock.expect(edmProperty.getType()).andStubThrow(new EdmException(null));
  } else {
    EasyMock.expect(edmProperty.getType()).andStubReturn(edmType);
  }
  EasyMock.expect(keyPredicate.getProperty()).andStubReturn(edmProperty);

  EasyMock.replay(edmMapping, edmProperty, keyPredicate);
  List<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
  keyPredicates.add(keyPredicate);
  return keyPredicates;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:JPQLJoinSelectSingleContextTest.java


示例5: testBuildSimpleQuery

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
/**
 * Test method for {@link org.apache.olingo.odata2.processor.jpa.jpql.JPQLSelectSingleStatementBuilder#build)}.
 * @throws EdmException
 * @throws ODataJPARuntimeException
 */

@Test
public void testBuildSimpleQuery() throws EdmException, ODataJPARuntimeException {
  EdmSimpleType edmType = EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance();
  JPQLSelectSingleContext JPQLSelectSingleContextImpl = createSelectContext(edmType);
  JPQLSelectSingleStatementBuilder = new JPQLSelectSingleStatementBuilder(JPQLSelectSingleContextImpl);

  String query = JPQLSelectSingleStatementBuilder.build().toString();
  query = query.substring(0, query.indexOf("?"));
  Map<String, Map<Integer, Object>> positionalParameters = 
      ODataParameterizedWhereExpressionUtil.getParameterizedQueryMap();
  for (Entry<String, Map<Integer, Object>> param : positionalParameters.entrySet()) {
    for (Entry<Integer, Object> postionalParam : param.getValue().entrySet()) {
      query += postionalParam.getValue();
    }
  }
  
  assertEquals("SELECT E1 FROM SalesOrderHeader E1 WHERE E1.Field1 = 1", query);

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:JPQLSelectSingleStatementBuilderTest.java


示例6: testBuildQueryWithSpecialChars

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
/**
 * Test method for {@link org.apache.olingo.odata2.processor.jpa.jpql.JPQLSelectSingleStatementBuilder#build)}.
 * @throws EdmException
 * @throws ODataJPARuntimeException
 */

@Test
public void testBuildQueryWithSpecialChars() throws EdmException, ODataJPARuntimeException {
  EdmSimpleType edmType = EdmSimpleTypeKind.String.getEdmSimpleTypeInstance();
  JPQLSelectSingleContext JPQLSelectSingleContextImpl = createSelectContext(edmType);
  JPQLSelectSingleStatementBuilder = new JPQLSelectSingleStatementBuilder(JPQLSelectSingleContextImpl);

  String query = JPQLSelectSingleStatementBuilder.build().toString();
  query = query.substring(0, query.indexOf("?"));
  Map<String, Map<Integer, Object>> positionalParameters = 
      ODataParameterizedWhereExpressionUtil.getParameterizedQueryMap();
  for (Entry<String, Map<Integer, Object>> param : positionalParameters.entrySet()) {
    for (Entry<Integer, Object> postionalParam : param.getValue().entrySet()) {
      query += postionalParam.getValue();
    }
  }
  
  assertEquals("SELECT E1 FROM SalesOrderHeader E1 WHERE E1.Field1 LIKE  MiMe-Id1", query);

}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:JPQLSelectSingleStatementBuilderTest.java


示例7: testFunctionImportNoName

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
/**
 * Test Case - Function Import with no names. Default name is Java method
 * name.
 */
@Test
public void testFunctionImportNoName() {
  VARIANT = 3;

  build();

  List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

  assertEquals(functionImportList.size(), 1);

  FunctionImport functionImport = functionImportList.get(0);
  assertEquals(functionImport.getName(), "method3");
  assertNotNull(functionImport.getMapping());

  ReturnType returnType = functionImport.getReturnType();
  assertNotNull(returnType);
  assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
  assertEquals(returnType.getTypeName().toString(), EdmSimpleTypeKind.Int32.getFullQualifiedName().toString());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:JPAEdmFunctionImportTest.java


示例8: valueOfStringInt32

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void valueOfStringInt32() throws Exception {
  final EdmSimpleType instance = EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance();

  assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
  assertEquals(Short.valueOf((short) 2), instance.valueOfString("2", EdmLiteralKind.JSON, null, Short.class));
  assertEquals(Integer.valueOf(-10000000), instance.valueOfString("-10000000", EdmLiteralKind.URI, null,
      Integer.class));
  assertEquals(Long.valueOf(10000000), instance.valueOfString("10000000", EdmLiteralKind.URI, null, Long.class));

  expectErrorInValueOfString(instance, "-2147483649", EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
  expectErrorInValueOfString(instance, "1.0", EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);

  expectTypeErrorInValueOfString(instance, "1", EdmLiteralKind.DEFAULT);
  expectUnconvertibleErrorInValueOfString(instance, "-129", Byte.class);
  expectUnconvertibleErrorInValueOfString(instance, "128", Byte.class);
  expectUnconvertibleErrorInValueOfString(instance, "-32769", Short.class);
  expectUnconvertibleErrorInValueOfString(instance, "32768", Short.class);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:EdmSimpleTypeTest.java


示例9: getType

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Override
public EdmType getType() throws EdmException {
  if (edmType == null) {
    final String namespace = typeName.getNamespace();
    if (EdmSimpleType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
      edmType = EdmSimpleTypeFacadeImpl.getEdmSimpleType(EdmSimpleTypeKind.valueOf(typeName.getName()));
    } else {
      edmType = edm.getComplexType(namespace, typeName.getName());
    }
    if (edmType == null) {
      edmType = edm.getEntityType(namespace, typeName.getName());
    }

    if (edmType == null) {
      throw new EdmException(EdmException.COMMON);
    }

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


示例10: valueToStringSByte

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void valueToStringSByte() throws Exception {
  final EdmSimpleType instance = EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance();

  assertEquals("0", instance.valueToString(0, EdmLiteralKind.DEFAULT, null));
  assertEquals("0", instance.valueToString(0, EdmLiteralKind.JSON, null));
  assertEquals("0", instance.valueToString(0, EdmLiteralKind.URI, null));
  assertEquals("8", instance.valueToString((byte) 8, EdmLiteralKind.DEFAULT, null));
  assertEquals("16", instance.valueToString((short) 16, EdmLiteralKind.DEFAULT, null));
  assertEquals("32", instance.valueToString(Integer.valueOf(32), EdmLiteralKind.DEFAULT, null));
  assertEquals("64", instance.valueToString(64L, EdmLiteralKind.DEFAULT, null));

  expectErrorInValueToString(instance, -129, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
  expectErrorInValueToString(instance, 128, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
  expectErrorInValueToString(instance, 'A', EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_TYPE_NOT_SUPPORTED);
  expectErrorInValueToString(instance, 1, null, null, EdmSimpleTypeException.LITERAL_KIND_MISSING);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:EdmSimpleTypeTest.java


示例11: setup

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {

  EdmProvider edmProvider = mock(EdmProvider.class);
  EdmImplProv edmImplProv = new EdmImplProv(edmProvider);

  mappedObject = new EdmMappingTest();

  Mapping propertySimpleMapping = new Mapping().setInternalName("value").setObject(mappedObject);
  CustomizableFeedMappings propertySimpleFeedMappings = new CustomizableFeedMappings().setFcKeepInContent(true);
  SimpleProperty propertySimple =
      new SimpleProperty().setName("PropertyName").setType(EdmSimpleTypeKind.String)
          .setMimeType("mimeType").setMapping(propertySimpleMapping).setCustomizableFeedMappings(
              propertySimpleFeedMappings);
  propertySimpleProvider = new EdmSimplePropertyImplProv(edmImplProv, propertySimple);

  NavigationProperty navProperty =
      new NavigationProperty().setName("navProperty").setFromRole("fromRole").setToRole("toRole").setMapping(
          propertySimpleMapping);
  navPropertyProvider = new EdmNavigationPropertyImplProv(edmImplProv, navProperty);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:EdmMappingTest.java


示例12: testDecimalCompatibility

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void testDecimalCompatibility() {
  testCompatibility(EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance(),
      Bit.getInstance(),
      Uint7.getInstance(),
      EdmSimpleTypeKind.Byte.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.Int16.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.Int64.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.Single.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.Double.getEdmSimpleTypeInstance(),
      EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance());
  assertFalse(EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance().isCompatible(
      EdmSimpleTypeKind.String.getEdmSimpleTypeInstance()));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:EdmSimpleTypeTest.java


示例13: valueOfStringSByte

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void valueOfStringSByte() throws Exception {
  final EdmSimpleType instance = EdmSimpleTypeKind.SByte.getEdmSimpleTypeInstance();

  assertEquals(Byte.valueOf((byte) 1), instance.valueOfString("1", EdmLiteralKind.DEFAULT, null, Byte.class));
  assertEquals(Short.valueOf((short) -2), instance.valueOfString("-2", EdmLiteralKind.JSON, null, Short.class));
  assertEquals(Byte.valueOf((byte) 127), instance.valueOfString("127", EdmLiteralKind.URI, null, Byte.class));
  assertEquals(Byte.valueOf((byte) -128), instance.valueOfString("-128", EdmLiteralKind.URI, null, Byte.class));
  assertEquals(Integer.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Integer.class));
  assertEquals(Long.valueOf(0), instance.valueOfString("0", EdmLiteralKind.DEFAULT, null, Long.class));

  expectErrorInValueOfString(instance, "128", EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
  expectErrorInValueOfString(instance, "-129", EdmLiteralKind.JSON, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);
  expectErrorInValueOfString(instance, "1.0", EdmLiteralKind.URI, null,
      EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT);

  expectTypeErrorInValueOfString(instance, "1", EdmLiteralKind.DEFAULT);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:EdmSimpleTypeTest.java


示例14: compareTypes

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void compareTypes() {
  compare(EdmSimpleTypeKind.Binary);
  compare(EdmSimpleTypeKind.Boolean);
  compare(EdmSimpleTypeKind.Byte);
  compare(EdmSimpleTypeKind.SByte);
  compare(EdmSimpleTypeKind.DateTime);
  compare(EdmSimpleTypeKind.DateTimeOffset);
  compare(EdmSimpleTypeKind.Decimal);
  compare(EdmSimpleTypeKind.Double);
  compare(EdmSimpleTypeKind.Guid);
  compare(EdmSimpleTypeKind.Int16);
  compare(EdmSimpleTypeKind.Int32);
  compare(EdmSimpleTypeKind.Int64);
  compare(EdmSimpleTypeKind.Single);
  compare(EdmSimpleTypeKind.Time);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:EdmSimpleTypeFacadeTest.java


示例15: validate

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void validate() throws Exception {
  for (EdmSimpleTypeKind kind : EdmSimpleTypeKind.values()) {
    if (kind == EdmSimpleTypeKind.Null) {
      continue;
    }
    final EdmSimpleType instance = kind.getEdmSimpleTypeInstance();
    assertTrue(instance.validate(null, null, null));
    assertTrue(instance.validate(null, null, getNullableFacets(null)));
    assertTrue(instance.validate(null, null, getNullableFacets(true)));
    assertFalse(instance.validate(null, null, getNullableFacets(false)));
    assertFalse(instance.validate("", null, null));
    assertFalse(instance.validate("ä", EdmLiteralKind.DEFAULT, getUnicodeFacets(false)));
    assertFalse(instance.validate("ä", EdmLiteralKind.URI, null));
  }

  assertTrue(EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance().validate("abcd", EdmLiteralKind.DEFAULT,
      getMaxLengthFacets(3)));
  assertFalse(EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance().validate("abcd", EdmLiteralKind.DEFAULT,
      getMaxLengthFacets(2)));

  assertTrue(EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance().validate("1.2", EdmLiteralKind.DEFAULT,
      getPrecisionScaleFacets(null, null)));
  assertFalse(EdmSimpleTypeKind.Decimal.getEdmSimpleTypeInstance().validate("1.2", EdmLiteralKind.DEFAULT,
      getPrecisionScaleFacets(null, 0)));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:EdmSimpleTypeTest.java


示例16: valueToStringInt16

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void valueToStringInt16() throws Exception {
  final EdmSimpleType instance = EdmSimpleTypeKind.Int16.getEdmSimpleTypeInstance();

  assertEquals("0", instance.valueToString(0, EdmLiteralKind.DEFAULT, null));
  assertEquals("0", instance.valueToString(0, EdmLiteralKind.JSON, null));
  assertEquals("0", instance.valueToString(0, EdmLiteralKind.URI, null));
  assertEquals("8", instance.valueToString((byte) 8, EdmLiteralKind.DEFAULT, null));
  assertEquals("16", instance.valueToString((short) 16, EdmLiteralKind.DEFAULT, null));
  assertEquals("32", instance.valueToString(Integer.valueOf(32), EdmLiteralKind.DEFAULT, null));
  assertEquals("255", instance.valueToString(255L, EdmLiteralKind.DEFAULT, null));

  expectErrorInValueToString(instance, 123456, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
  expectErrorInValueToString(instance, -32769, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);

  expectErrorInValueToString(instance, 1.0, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_TYPE_NOT_SUPPORTED);
  expectErrorInValueToString(instance, 1, null, null, EdmSimpleTypeException.LITERAL_KIND_MISSING);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:EdmSimpleTypeTest.java


示例17: valueToStringByte

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Test
public void valueToStringByte() throws Exception {
  final EdmSimpleType instance = EdmSimpleTypeKind.Byte.getEdmSimpleTypeInstance();

  assertEquals("0", instance.valueToString(0, EdmLiteralKind.DEFAULT, null));
  assertEquals("0", instance.valueToString(0, EdmLiteralKind.JSON, null));
  assertEquals("0", instance.valueToString(0, EdmLiteralKind.URI, null));
  assertEquals("8", instance.valueToString((byte) 8, EdmLiteralKind.DEFAULT, null));
  assertEquals("16", instance.valueToString((short) 16, EdmLiteralKind.DEFAULT, null));
  assertEquals("32", instance.valueToString(Integer.valueOf(32), EdmLiteralKind.DEFAULT, null));
  assertEquals("255", instance.valueToString(255L, EdmLiteralKind.DEFAULT, null));

  expectErrorInValueToString(instance, -1, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
  expectErrorInValueToString(instance, 256, EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_ILLEGAL_CONTENT);
  expectErrorInValueToString(instance, 'A', EdmLiteralKind.DEFAULT, null,
      EdmSimpleTypeException.VALUE_TYPE_NOT_SUPPORTED);
  expectErrorInValueToString(instance, 1, null, null, EdmSimpleTypeException.LITERAL_KIND_MISSING);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:EdmSimpleTypeTest.java


示例18: getEntityType

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Override
public EntityType getEntityType ()
{
   List<Property> properties = new ArrayList<Property> ();
   properties.add (new SimpleProperty ().setName (ID)
      .setType (EdmSimpleTypeKind.String)
      .setFacets (new Facets ().setNullable (false)));
   properties.add (new SimpleProperty ()
      .setName (NAME)
      .setType (EdmSimpleTypeKind.String)
      .setCustomizableFeedMappings (
         new CustomizableFeedMappings ()
            .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));
   properties.add (new SimpleProperty ().setName (CONTENT_TYPE).setType (
      EdmSimpleTypeKind.String));
   properties.add (new SimpleProperty ().setName (CONTENT_LENGTH).setType (
      EdmSimpleTypeKind.Int64));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   // TODO (OData v3) setOpenType(true) setAbstract(true)
   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:28,代码来源:ItemEntitySet.java


示例19: getEntityType

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Override
public EntityType getEntityType ()
{
   // Properties
   List<Property> properties = new ArrayList<Property> ();

   properties.add (new SimpleProperty ()
   .setName (ID)
   .setType (EdmSimpleTypeKind.Int64)
   .setFacets (new Facets ().setNullable (false))
   .setCustomizableFeedMappings (
      new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE)));

   // Key
   Key key =
      new Key ().setKeys (Collections.singletonList (new PropertyRef ()
         .setName (ID)));

   // Navigation Properties
   List<NavigationProperty> navigationProperties =
      new ArrayList<NavigationProperty> ();

   if (Security.currentUserHasRole(Role.STATISTICS))
   {
      navigationProperties.add (new NavigationProperty ()
         .setName ("NetworkStatistic")
         .setRelationship (ASSO_NETWORK_NETWORKSTATISTIC)
         .setFromRole (ROLE_NETWORKSTATISTIC_NETWORK)
         .setToRole (ROLE_NETWORK_NETWORKSTATISTIC));
   }

   return new EntityType ().setName (ENTITY_NAME).setProperties (properties)
      .setKey (key).setNavigationProperties (navigationProperties);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:36,代码来源:NetworkEntitySet.java


示例20: getEntityType

import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind; //导入依赖的package包/类
@Override
public EntityType getEntityType ()
{
   List<Property> properties = new ArrayList<> ();

   SimpleProperty uuid = new SimpleProperty ();
   uuid.setName (UUID);
   uuid.setType (EdmSimpleTypeKind.String);
   uuid.setFacets (new Facets ().setNullable (false));
   uuid.setCustomizableFeedMappings (new CustomizableFeedMappings ()
         .setFcTargetPath (EdmTargetPath.SYNDICATION_TITLE));
   properties.add (uuid);

   SimpleProperty restriction_type = new SimpleProperty ();
   restriction_type.setName (RESTRICTION_TYPE);
   restriction_type.setType (EdmSimpleTypeKind.String);
   restriction_type.setFacets (new Facets ().setNullable (false));
   properties.add (restriction_type);

   SimpleProperty reason = new SimpleProperty ();
   reason.setName (REASON);
   reason.setType (EdmSimpleTypeKind.String);
   reason.setFacets (new Facets ().setNullable (false));
   properties.add (reason);

   Key key = new Key ();
   List<PropertyRef> propertyRefs = Collections.singletonList (
         new PropertyRef ().setName (UUID));
   key.setKeys (propertyRefs);

   EntityType entityType = new EntityType ();
   entityType.setName (ENTITY_NAME);
   entityType.setProperties (properties);
   entityType.setKey (key);

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DatabindingFactory类代码示例发布时间:2022-05-22
下一篇:
Java Spline类代码示例发布时间: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