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

Java Edm类代码示例

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

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



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

示例1: service

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Override
public void service(HttpServletRequest request, HttpServletResponse response)
        throws IOException {
    Client client = (Client) request.getAttribute(Client.class.getName());
    String schemaName = (String) request.getAttribute(ODataFilter.SCHEMA_NAME);

    org.teiid.metadata.Schema teiidSchema = client.getMetadataStore().getSchema(schemaName);
    if (teiidSchema == null || !isVisible(client.getVDB(), teiidSchema)) {
        // TODO: send error response, this is exception
        throw new TeiidRuntimeException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16022));
    }

    OData odata = OData.newInstance();
    Schema schema = OData4EntitySchemaBuilder.buildMetadata(teiidSchema);
    Edm edm = odata.createEdm(new TeiidEdmProvider(client.getMetadataStore(), schema));

    ODataHttpHandler handler = odata.createHandler(edm);
    boolean prepared = true;
    if (request.getParameter("prepared") != null) { //$NON-NLS-1$
        prepared = Boolean.getBoolean(request.getParameter("prepared")); //$NON-NLS-1$
    }
    handler.register(new TeiidProcessor(client, prepared));
    handler.process(request, response);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:ODataServlet.java


示例2: createESBase

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EntityCollection createESBase(final Edm edm, final OData odata) {
  final EntityCollection entityCollection = new EntityCollection();

  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 111))
          .addProperty(createPrimitive("PropertyString", "TEST A"))
          .addProperty(createPrimitive("AdditionalPropertyString_5", "TEST A 0815")));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 222))
          .addProperty(createPrimitive("PropertyString", "TEST B"))
          .addProperty(createPrimitive("AdditionalPropertyString_5", "TEST C 0815")));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 333))
          .addProperty(createPrimitive("PropertyString", "TEST C"))
          .addProperty(createPrimitive("AdditionalPropertyString_5", "TEST E 0815")));
  setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETBase));
  createEntityId(edm, odata, "ESBase", entityCollection);

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


示例3: createESBaseTwoKeyNav

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EntityCollection createESBaseTwoKeyNav(final Edm edm, final OData odata) {
  final EntityCollection entityCollection = new EntityCollection();

  entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 1, "1")
      .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
  entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 1, "2")
      .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
  entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 2, "1")
      .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
  entityCollection.getEntities().add(createESTwoKeyNavEntity((short) 3, "1")
      .addProperty(createPrimitive("PropertyDate", getDateTime(2013, 12, 12, 0, 0, 0))));
  setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav));
  createEntityId(edm, odata, "ESBaseTwoKeyNav", entityCollection);

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


示例4: createESTwoBase

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EntityCollection createESTwoBase(final Edm edm, final OData odata) {
  final EntityCollection entityCollection = new EntityCollection();

  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 111))
          .addProperty(createPrimitive("PropertyString", "TEST A"))
          .addProperty(createPrimitive("AdditionalPropertyString_5", "TEST A 0815"))
          .addProperty(createPrimitive("AdditionalPropertyString_6", "TEST B 0815")));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 222))
          .addProperty(createPrimitive("PropertyString", "TEST B"))
          .addProperty(createPrimitive("AdditionalPropertyString_5", "TEST C 0815"))
          .addProperty(createPrimitive("AdditionalPropertyString_6", "TEST D 0815")));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 333))
          .addProperty(createPrimitive("PropertyString", "TEST C"))
          .addProperty(createPrimitive("AdditionalPropertyString_5", "TEST E 0815"))
          .addProperty(createPrimitive("AdditionalPropertyString_6", "TEST F 0815")));
  setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETTwoBase));
  createEntityId(edm, odata, "ESTwoBase", entityCollection);

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


示例5: createESTwoPrim

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EntityCollection createESTwoPrim(final Edm edm, final OData odata) {
  EntityCollection entityCollection = new EntityCollection();

  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) 32766))
          .addProperty(createPrimitive("PropertyString", "Test String1")));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) -365))
          .addProperty(createPrimitive("PropertyString", "Test String2")));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", (short) -32766))
          .addProperty(createPrimitive("PropertyString", null)));
  entityCollection.getEntities()
      .add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
          .addProperty(createPrimitive("PropertyString", "Test String4")));

  setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETTwoPrim));
  createEntityId(edm, odata, "ESTwoPrim", entityCollection);

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


示例6: getEdmTest

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void getEdmTest() throws Exception {
  final ODataClient client = getODataClient();
  final String serviceUrl = getServiceUrl();
  final ODataServiceDocumentRequest reqeust =
      client.getRetrieveRequestFactory().getServiceDocumentRequest(serviceUrl);

  reqeust.setFormat(ContentType.APPLICATION_XML);

  final Edm redHelixEdm = readEdm(client, serviceUrl);

  Assert.assertEquals(1, redHelixEdm.getSchemas().size());

  for (EdmSchema schema : redHelixEdm.getSchemas()) {
    Assert.assertEquals(RED_HELIX_NAME_SPACE, schema.getNamespace());
  }
}
 
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:18,代码来源:EdmTest.java


示例7: readMetadataWithTerm

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void readMetadataWithTerm() {
  EdmMetadataRequest request = getClient().getRetrieveRequestFactory().getMetadataRequest(SERVICE_URI);
  assertNotNull(request);
  setCookieHeader(request);
  
  ODataRetrieveResponse<Edm> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());

  Edm edm = response.getBody();
  assertNotNull(edm);
  
  final EdmTerm descriptionTerm = edm.getTerm(new FullQualifiedName("Core", "Description"));
  assertNotNull(descriptionTerm);
  assertEquals(descriptionTerm.getFullQualifiedName(),
      edm.getTerm(new FullQualifiedName("Org.OData.Core.V1", "Description")).getFullQualifiedName());  
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:BasicITCase.java


示例8: test2Olingo1064

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void test2Olingo1064() throws ODataDeserializerException {
  EdmMetadataRequest request = getClient().getRetrieveRequestFactory().getMetadataRequest(SERVICE_URI);
  assertNotNull(request);
  setCookieHeader(request);    
  
  ODataRetrieveResponse<Edm> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());

  Edm edm = response.getBody();
  
  EdmEnabledODataClient odataClient = ODataClientFactory.getEdmEnabledClient(SERVICE_URI, edm, null);
  final InputStream input = Thread.currentThread().getContextClassLoader().
      getResourceAsStream("ESCompAllPrimWithNullValueForComplexProperty.json");
  ClientEntity entity = odataClient.getReader().readEntity(input, ContentType.JSON);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  assertNotNull(entity.getProperty(PROPERTY_COMP).getComplexValue());
  assertEquals("olingo.odata.test1.CTAllPrim", entity.getProperty(PROPERTY_COMP).getComplexValue().getTypeName());
  assertEquals(PROPERTY_COMP, entity.getProperty(PROPERTY_COMP).getName());
  assertTrue(entity.getProperty(PROPERTY_COMP).hasNullValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:BasicITCase.java


示例9: testOLINGO1100

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void testOLINGO1100() {
  final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("olingo1100.xml"));
  assertNotNull(edm);
  final EdmEntityContainer container = edm.getEntityContainer(
      new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "EntityContainer"));
  assertNotNull(container);
  final EdmEntitySet providers = container.getEntitySet("Provider");
  assertNotNull(providers);
  assertEquals(edm.getEntityType(new FullQualifiedName(container.getNamespace(), "Provider")),
      providers.getEntityType());
  assertEquals(container.getEntitySet("ProviderLicense"), providers.getRelatedBindingTarget("ProviderLicense"));
  assertNull(providers.getRelatedBindingTarget("ProviderLicensePractice"));
  assertNull(providers.getRelatedBindingTarget("Provider"));
  final EdmEntitySet providerLicenses = container.getEntitySet("ProviderLicense");
  assertEquals(edm.getEntityType(new FullQualifiedName(container.getNamespace(), "ProviderLicense")),
      providerLicenses.getEntityType());
  assertEquals(container.getEntitySet("ProviderLicensePractice"), 
      providerLicenses.getRelatedBindingTarget("ProviderLicensePractice"));
  assertNull(providerLicenses.getRelatedBindingTarget("ProviderLicense"));
  assertNull(providerLicenses.getRelatedBindingTarget("Provider"));
  final EdmEntitySet providerLicensePractices = container.getEntitySet("ProviderLicensePractice");
  assertNull(providerLicensePractices.getRelatedBindingTarget("ProviderLicensePractice"));
  assertNull(providerLicensePractices.getRelatedBindingTarget("Provider"));
  assertNull(providerLicenses.getRelatedBindingTarget("ProviderLicense"));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:MetadataTest.java


示例10: termWithTypeDef

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void termWithTypeDef() {
  CsdlTerm csdlTerm = new CsdlTerm();
  FullQualifiedName csdlTerm1Name = new FullQualifiedName("namespace", "name1");
  csdlTerm.setName(csdlTerm1Name.getName());
  String namespaceAndName = "mySchema.TypeDef";
  String name = "TypeDef";
  csdlTerm.setType(namespaceAndName);
  Edm edm = mock(Edm.class);
  EdmTypeDefinition typeMock = mock(EdmTypeDefinition.class);
  when(typeMock.getName()).thenReturn(name);
  when(edm.getTypeDefinition(new FullQualifiedName(namespaceAndName))).thenReturn(typeMock);
  EdmTerm localTerm = new EdmTermImpl(edm, "namespace", csdlTerm);
  assertNotNull(localTerm.getType());
  assertEquals(name, localTerm.getType().getName());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:EdmTermImplTest.java


示例11: createUriParameter

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private static UriParameter createUriParameter(final EdmProperty edmProperty, final String parameterName,
    final String literalValue, final Edm edm, final EdmType referringType,
    final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException {
  final AliasQueryOption alias = literalValue.startsWith("@") ?
      getKeyAlias(literalValue, edmProperty, edm, referringType, aliases) :
      null;
  final String value = alias == null ? literalValue : alias.getText();
  final EdmPrimitiveType primitiveType = (EdmPrimitiveType) edmProperty.getType();
  try {
    if (!(primitiveType.validate(primitiveType.fromUriLiteral(value), edmProperty.isNullable(),
        edmProperty.getMaxLength(), edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode()))) {
      throw new UriValidationException("Invalid key property",
          UriValidationException.MessageKeys.INVALID_KEY_PROPERTY, parameterName);
    }
  } catch (final EdmPrimitiveTypeException e) {
    throw new UriValidationException("Invalid key property", e,
        UriValidationException.MessageKeys.INVALID_KEY_PROPERTY, parameterName);
  }

  return new UriParameterImpl()
      .setName(parameterName)
      .setText("null".equals(literalValue) ? null : literalValue)
      .setAlias(alias == null ? null : literalValue)
      .setExpression(alias == null ? null :
          alias.getValue() == null ? new LiteralImpl(value, primitiveType) : alias.getValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:ParserHelper.java


示例12: keyPropertyGuidStartsWithNumber

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void keyPropertyGuidStartsWithNumber() throws Exception {
  final String entitySetName = "ESGuid";
  final String keyPropertyName = "a";
  EdmProperty keyProperty = Mockito.mock(EdmProperty.class);
  Mockito.when(keyProperty.getType())
      .thenReturn(OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Guid));
  EdmKeyPropertyRef keyPropertyRef = Mockito.mock(EdmKeyPropertyRef.class);
  Mockito.when(keyPropertyRef.getName()).thenReturn(keyPropertyName);
  Mockito.when(keyPropertyRef.getProperty()).thenReturn(keyProperty);
  EdmEntityType entityType = Mockito.mock(EdmEntityType.class);
  Mockito.when(entityType.getKeyPredicateNames()).thenReturn(Collections.singletonList(keyPropertyName));
  Mockito.when(entityType.getKeyPropertyRefs()).thenReturn(Collections.singletonList(keyPropertyRef));
  Mockito.when(entityType.getPropertyNames()).thenReturn(Collections.singletonList(keyPropertyName));
  Mockito.when(entityType.getProperty(keyPropertyName)).thenReturn(keyProperty);
  EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
  Mockito.when(entitySet.getName()).thenReturn(entitySetName);
  Mockito.when(entitySet.getEntityType()).thenReturn(entityType);
  EdmEntityContainer container = Mockito.mock(EdmEntityContainer.class);
  Mockito.when(container.getEntitySet(entitySetName)).thenReturn(entitySet);
  Edm mockedEdm = Mockito.mock(Edm.class);
  Mockito.when(mockedEdm.getEntityContainer()).thenReturn(container);
  new TestUriValidator().setEdm(mockedEdm)
      .run("ESGuid", "$filter=a eq 889e3e73-af9f-4cd4-b330-db93c25ff3c7");
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:ParserTest.java


示例13: createESFourKeyAlias

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EntityCollection createESFourKeyAlias(final Edm edm, final OData odata) {
  final EntityCollection entityCollection = new EntityCollection();

  entityCollection.getEntities().add(new Entity()
      .addProperty(createPrimitive("PropertyInt16", (short) 1))
      .addProperty(createComplex("PropertyComp",
          ComplexTypeProvider.nameCTTwoPrim.getFullQualifiedNameAsString(),
          createPrimitive("PropertyInt16", (short) 11),
          createPrimitive("PropertyString", "Num11")
          ))
      .addProperty(createComplex("PropertyCompComp",
          ComplexTypeProvider.nameCTCompComp.getFullQualifiedNameAsString(),
          createComplex("PropertyComp",
              ComplexTypeProvider.nameCTBase.getFullQualifiedNameAsString(),
              createPrimitive("PropertyInt16", (short) 111),
              createPrimitive("PropertyString", "Num111"),
              createPrimitive("AdditionalPropString", "Test123")
          )
          ))
      );

  setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETFourKeyAlias));
  createEntityId(edm, odata, "ESFourKeyAlias", entityCollection);
  createOperations("ESFourKeyAlias", entityCollection, EntityTypeProvider.nameETFourKeyAlias);
  return entityCollection;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DataCreator.java


示例14: createESTwoPrim

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EntityCollection createESTwoPrim(final Edm edm, final OData odata) {
  EntityCollection entityCollection = new EntityCollection();

  entityCollection.getEntities().add(new Entity()
      .addProperty(createPrimitive("PropertyInt16", (short) 32766))
      .addProperty(createPrimitive("PropertyString", "Test String1")));

  entityCollection.getEntities().add(new Entity()
      .addProperty(createPrimitive("PropertyInt16", (short) -365))
      .addProperty(createPrimitive("PropertyString", "Test String2")));

  entityCollection.getEntities().add(new Entity()
      .addProperty(createPrimitive("PropertyInt16", (short) -32766))
      .addProperty(createPrimitive("PropertyString", null)));

  entityCollection.getEntities().add(new Entity()
      .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
      .addProperty(createPrimitive("PropertyString", "Test String4")));

  setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETTwoPrim));
  createEntityId(edm, odata, "ESTwoPrim", entityCollection);
  createOperations("ESTwoPrim", entityCollection, EntityTypeProvider.nameETTwoPrim);
  return entityCollection;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:25,代码来源:DataCreator.java


示例15: keyValuePair

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private static UriParameter keyValuePair(UriTokenizer tokenizer,
    final String keyPredicateName, final EdmEntityType edmEntityType,
    final Edm edm, final EdmType referringType, final Map<String, AliasQueryOption> aliases)
    throws UriParserException, UriValidationException {
  final EdmKeyPropertyRef keyPropertyRef = edmEntityType.getKeyPropertyRef(keyPredicateName);
  final EdmProperty edmProperty = keyPropertyRef == null ? null : keyPropertyRef.getProperty();
  if (edmProperty == null) {
    throw new UriValidationException(keyPredicateName + " is not a valid key property name.",
        UriValidationException.MessageKeys.INVALID_KEY_PROPERTY, keyPredicateName);
  }
  ParserHelper.requireNext(tokenizer, TokenKind.EQ);
  if (tokenizer.next(TokenKind.COMMA) || tokenizer.next(TokenKind.CLOSE) || tokenizer.next(TokenKind.EOF)) {
    throw new UriParserSyntaxException("Key value expected.", UriParserSyntaxException.MessageKeys.SYNTAX);
  }
  if (nextPrimitiveTypeValue(tokenizer, (EdmPrimitiveType) edmProperty.getType(), edmProperty.isNullable())) {
    return createUriParameter(edmProperty, keyPredicateName, tokenizer.getText(), edm, referringType, aliases);
  } else {
    throw new UriParserSemanticException(keyPredicateName + " has not a valid  key value.",
        UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE, keyPredicateName);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:ParserHelper.java


示例16: writeServiceWithEmptyMockedEdm

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
@Test
public void writeServiceWithEmptyMockedEdm() throws Exception {
  final Edm edm = mock(Edm.class);
  EdmEntityContainer container = mock(EdmEntityContainer.class);
  when(container.getFullQualifiedName()).thenReturn(new FullQualifiedName("service", "test"));
  when(container.getEntitySets()).thenReturn(Collections.<EdmEntitySet> emptyList());
  when(container.getFunctionImports()).thenReturn(Collections.<EdmFunctionImport> emptyList());
  when(container.getSingletons()).thenReturn(Collections.<EdmSingleton> emptyList());
  when(edm.getEntityContainer()).thenReturn(container);
  ServiceMetadata metadata = mock(ServiceMetadata.class);
  when(metadata.getEdm()).thenReturn(edm);

  assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
      + "<app:service xmlns:atom=\"http://www.w3.org/2005/Atom\" "
      + "xmlns:app=\"http://www.w3.org/2007/app\" "
      + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
      + "metadata:context=\"http://host/svc/$metadata\">"
      + "<app:workspace><atom:title>service.test</atom:title></app:workspace>"
      + "</app:service>",
      IOUtils.toString(serializer.serviceDocument(metadata, "http://host/svc").getContent()));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:ServiceDocumentXmlSerializerTest.java


示例17: EdmEnumTypeImpl

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


示例18: applyOrderByOption

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
public static void applyOrderByOption(final OrderByOption orderByOption, final EntityCollection entitySet,
    final UriInfoResource uriInfo, final Edm edm) throws ODataApplicationException {

  if (orderByOption == null) {
    return;
  }

  try {
    applyOrderByOptionInternal(orderByOption, entitySet, uriInfo, edm);
  } catch (SystemQueryOptionsRuntimeException e) {
    if (e.getCause() instanceof ODataApplicationException) {
      // Throw the nested exception, to send the correct HTTP status code in the HTTP response
      throw (ODataApplicationException) e.getCause();
    } else {
      throw new ODataApplicationException("Exception in orderBy evaluation",
          HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:OrderByHandler.java


示例19: applyOptionsToEntityCollection

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private void applyOptionsToEntityCollection(final EntityCollection entitySet,
    final EdmBindingTarget edmBindingTarget,
    final FilterOption filterOption, final OrderByOption orderByOption, final CountOption countOption,
    final SkipOption skipOption, final TopOption topOption, final ExpandOption expandOption,
    final UriInfoResource uriInfo, final Edm edm)
    throws ODataApplicationException {

  FilterHandler.applyFilterSystemQuery(filterOption, entitySet, uriInfo, edm);
  OrderByHandler.applyOrderByOption(orderByOption, entitySet, uriInfo, edm);
  CountHandler.applyCountSystemQueryOption(countOption, entitySet);
  SkipHandler.applySkipSystemQueryHandler(skipOption, entitySet);
  TopHandler.applyTopSystemQueryOption(topOption, entitySet);

  // Apply nested expand system query options to remaining entities
  if (expandOption != null) {
    for (final Entity entity : entitySet.getEntities()) {
      applyExpandOptionToEntity(entity, edmBindingTarget, expandOption, uriInfo, edm);
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:ExpandSystemQueryOptionHandler.java


示例20: getEdmEnabledClient1

import org.apache.olingo.commons.api.edm.Edm; //导入依赖的package包/类
private EdmEnabledODataClient getEdmEnabledClient1() {
  return new EdmEnabledODataClientImpl(null, null, null) {

    private Edm edm;

    @Override
    public Edm getEdm(final String metadataETag) {
      return getCachedEdm();
    }

    @Override
    public Edm getCachedEdm() {
      if (edm == null) {
        edm = getReader().readMetadata(getClass().getResourceAsStream("metadata_sample.xml"));
      }
      return edm;
    }

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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