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


Java Edm类代码示例

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


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


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