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

Java Edm类代码示例

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

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



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

示例1: readOptimizedFilter

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void readOptimizedFilter() throws Exception {
  GetEntitySetUriInfo uriInfo = createMockedUriInfo("Rooms");
  Edm edm = EdmMock.createMockEdm();

  FilterExpression exp = UriParserImpl.parseFilter(edm, edm.getEntityType("RefScenario", "Room"), "Version gt 105");
  Mockito.when(uriInfo.getFilter()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  ReadResult<Room> readResult = ReadResult.forResult(results).filterApplied().build();
  Mockito.when(mockedDataSource.readData(Mockito.any(EdmEntitySet.class), Mockito.any(ReadOptions.class)))
      .thenReturn((ReadResult)readResult);

  ODataResponse result = dataSourceProcessor.readEntitySet(uriInfo, "application/json");

  StringHelper.Stream resultStream = StringHelper.toStream(result.getEntityAsStream());
  List<LinkedTreeMap<?, ?>> parsedResults = JsonHelper.getResults(resultStream.asString());
  Assert.assertEquals(10, parsedResults.size());
  Assert.assertEquals("Room with id: 1", parsedResults.get(0).get("Name"));
  Assert.assertEquals("Room with id: 9", parsedResults.get(9).get("Name"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:22,代码来源:DataSourceProcessorTest.java


示例2: setupClient

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
protected static void setupClient() throws Exception {
    olingoApp = new Olingo2AppImpl(TEST_SERVICE_URL + "/");
    olingoApp.setContentType(TEST_FORMAT_STRING);

    LOG.info("Read Edm ");
    final TestOlingo2ResponseHandler<Edm> responseHandler = new TestOlingo2ResponseHandler<Edm>();

    olingoApp.read(null, Olingo2AppImpl.METADATA, null, responseHandler);

    edm = responseHandler.await();
    LOG.info("Read default EntityContainer:  {}", responseHandler.await().getDefaultEntityContainer().getName());

    edmEntitySetMap = new HashMap<String, EdmEntitySet>();
    for (EdmEntitySet ees : edm.getEntitySets()) {
        edmEntitySetMap.put(ees.getName(), ees);
    }

    // wait for generated data to be registered in server
    Thread.sleep(2000);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:Olingo2AppAPITest.java


示例3: read

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Override
public <T> void read(final Edm edm, final String resourcePath, final Map<String, String> queryParams,
                     final Olingo2ResponseHandler<T> responseHandler) {

    final UriInfoWithType uriInfo = parseUri(edm, resourcePath, queryParams);

    execute(new HttpGet(createUri(resourcePath, queryParams)), getResourceContentType(uriInfo),
        new AbstractFutureCallback<T>(responseHandler) {

            @Override
            public void onCompleted(HttpResponse result) throws IOException {
                readContent(uriInfo, result.getEntity() != null ? result.getEntity().getContent() : null,
                    responseHandler);
            }

        });
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:Olingo2AppImpl.java


示例4: uread

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Override
public void uread(final Edm edm, final String resourcePath, final Map<String, String> queryParams,
                  final Olingo2ResponseHandler<InputStream> responseHandler) {

    final UriInfoWithType uriInfo = parseUri(edm, resourcePath, queryParams);

    execute(new HttpGet(createUri(resourcePath, queryParams)), getResourceContentType(uriInfo),
        new AbstractFutureCallback<InputStream>(responseHandler) {

            @Override
            public void onCompleted(HttpResponse result) throws IOException {
                responseHandler.onResponse(result.getEntity() != null ? result.getEntity().getContent() : null);
            }

        });
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:Olingo2AppImpl.java


示例5: parseFilterExpression

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
/**
 * Parse an OData filter expression and return a JPA predicate
 * 
 * @param oDataFilter OData filter string e.g. "displayName eq 'Test' and version = 1"
 * @return
 */
public Predicate parseFilterExpression(CriteriaBuilder cb, Root<T> table, String oDataFilter)
{
	if (logger != null && logger.isDebugEnabled())
		logger.debug(LOG_TAG, "ODataFilterToJpaQueryBuilder.parseFilterExpression \"" + oDataFilter + "\"");

	if (oDataFilter == null || oDataFilter.trim().length() == 0)
	{
		return null;
	}

	Edm edm = null;
	EdmEntityType edmType = null;
	FilterExpression filterExpression;
	try
	{
		filterExpression = UriParser.parseFilter(edm, edmType, oDataFilter);
	}
	catch (ODataMessageException e)
	{
		throw new IllegalArgumentException("Cannot parse OData filter \"" + oDataFilter + "\"", e);
	}
	CommonExpression commonExpression = filterExpression.getExpression();
	return this.processFilterExpression(cb, table, commonExpression);
}
 
开发者ID:giraone,项目名称:pms-sample-jee-01,代码行数:31,代码来源:ODataToJpaQueryBuilder.java


示例6: readEdm

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
private Edm readEdm() throws EntityProviderException,
		IllegalStateException, IOException {

	// This is used for both setting the Edm and CSRF Token :)
	if (m_edm != null) {
		return m_edm;
	}

	String serviceUrl = new StringBuilder(getODataServiceUrl())
			.append(SEPARATOR).append(METADATA).toString();

	logger.info("Metadata url => " + serviceUrl);

	final HttpGet get = new HttpGet(serviceUrl);
	get.setHeader(AUTHORIZATION_HEADER, getAuthorizationHeader());
	get.setHeader(CSRF_TOKEN_HEADER, CSRF_TOKEN_FETCH);

	HttpResponse response = getHttpClient().execute(get);

	m_csrfToken = response.getFirstHeader(CSRF_TOKEN_HEADER).getValue();
	logger.info("CSRF token => " + m_csrfToken);

	m_edm = EntityProvider.readMetadata(response.getEntity().getContent(),
			false);
	return m_edm;
}
 
开发者ID:SAP,项目名称:C4CODATAAPIDEVGUIDE,代码行数:27,代码来源:ServiceTicketODataConsumer.java


示例7: readOrder

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void readOrder() throws Exception {
  GetEntitySetUriInfo uriInfo = createMockedUriInfo("Rooms");
  Edm edm = EdmMock.createMockEdm();

  OrderByExpression exp = UriParserImpl.parseOrderBy(edm, edm.getEntityType("RefScenario", "Room"), "Name");
  Mockito.when(uriInfo.getOrderBy()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  Collections.reverse(results);
  ReadResult<Room> readResult = ReadResult.forResult(results).build();
  Mockito.when(mockedDataSource.readData(Mockito.any(EdmEntitySet.class), Mockito.any(ReadOptions.class)))
      .thenReturn((ReadResult)readResult);

  ODataResponse result = dataSourceProcessor.readEntitySet(uriInfo, "application/json");

  StringHelper.Stream resultStream = StringHelper.toStream(result.getEntityAsStream());
  List<LinkedTreeMap<?, ?>> parsedResults = JsonHelper.getResults(resultStream.asString());
  Assert.assertEquals(10, parsedResults.size());
  Assert.assertEquals("Room with id: 1", parsedResults.get(0).get("Name"));
  Assert.assertEquals("Room with id: 9", parsedResults.get(9).get("Name"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:23,代码来源:DataSourceProcessorTest.java


示例8: optimizedReadOrder

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void optimizedReadOrder() throws Exception {
  GetEntitySetUriInfo uriInfo = createMockedUriInfo("Rooms");
  Edm edm = EdmMock.createMockEdm();

  OrderByExpression exp = UriParserImpl.parseOrderBy(edm, edm.getEntityType("RefScenario", "Room"), "Name");
  Mockito.when(uriInfo.getOrderBy()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  Collections.shuffle(results);
  ReadResult<Room> readResult = ReadResult.forResult(results).orderApplied().build();
  Mockito.when(mockedDataSource.readData(Mockito.any(EdmEntitySet.class), Mockito.any(ReadOptions.class)))
      .thenReturn((ReadResult)readResult);

  ODataResponse result = dataSourceProcessor.readEntitySet(uriInfo, "application/json");

  StringHelper.Stream resultStream = StringHelper.toStream(result.getEntityAsStream());
  List<LinkedTreeMap<?, ?>> parsedResults = JsonHelper.getResults(resultStream.asString());
  Assert.assertEquals(10, parsedResults.size());
  Assert.assertEquals("Room with id: 1", parsedResults.get(0).get("Name"));
  Assert.assertEquals("Room with id: 9", parsedResults.get(9).get("Name"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:23,代码来源:DataSourceProcessorTest.java


示例9: readFilter

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void readFilter() throws Exception {
  GetEntitySetUriInfo uriInfo = createMockedUriInfo("Rooms");
  Edm edm = EdmMock.createMockEdm();

  FilterExpression exp = UriParserImpl.parseFilter(edm, edm.getEntityType("RefScenario", "Room"), "Version gt 105");
  Mockito.when(uriInfo.getFilter()).thenReturn(exp);

  List<Room> results = createRooms(1, 10);
  ReadResult<Room> readResult = ReadResult.forResult(results).build();
  Mockito.when(mockedDataSource.readData(Mockito.any(EdmEntitySet.class), Mockito.any(ReadOptions.class)))
      .thenReturn((ReadResult)readResult);

  ODataResponse result = dataSourceProcessor.readEntitySet(uriInfo, "application/json");

  StringHelper.Stream resultStream = StringHelper.toStream(result.getEntityAsStream());
  List<LinkedTreeMap<?, ?>> parsedResults = JsonHelper.getResults(resultStream.asString());
  Assert.assertEquals(5, parsedResults.size());
  Assert.assertEquals("Room with id: 10", parsedResults.get(0).get("Name"));
  Assert.assertEquals("Room with id: 9", parsedResults.get(4).get("Name"));
}
 
开发者ID:mibo,项目名称:janos,代码行数:22,代码来源:DataSourceProcessorTest.java


示例10: collectionComplexType

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void collectionComplexType() throws Exception {
  final String xml = "<d:AllLocations xmlns:d=\"" + Edm.NAMESPACE_D_2007_08 + "\">"
      + "<d:element><d:City><d:PostalCode>69124</d:PostalCode><d:CityName>Heidelberg</d:CityName></d:City>"
      + "<d:Country>Germany</d:Country></d:element>"
      + "<d:element m:type=\"RefScenario.c_Location\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">"
      + "<d:City m:type=\"RefScenario.c_City\"><d:PostalCode>69190</d:PostalCode><d:CityName>Walldorf</d:CityName>"
      + "</d:City><d:Country>Germany</d:Country></d:element>"
      + "</d:AllLocations>";
  @SuppressWarnings("unchecked")
  final List<?> result = (List<String>) new XmlPropertyConsumer().readCollection(createReaderForTest(xml, true),
      EntityInfoAggregator.create(MockFacade.getMockEdm().getDefaultEntityContainer()
          .getFunctionImport("AllLocations")),
      EntityProviderReadProperties.init().build());
  assertNotNull(result);
  assertEquals(2, result.size());
  @SuppressWarnings("unchecked")
  final Map<String, Object> secondLocation = (Map<String, Object>) result.get(1);
  assertEquals("Germany", secondLocation.get("Country"));
  @SuppressWarnings("unchecked")
  final Map<String, Object> secondCity = (Map<String, Object>) secondLocation.get("City");
  assertEquals("Walldorf", secondCity.get("CityName"));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:XmlPropertyConsumerTest.java


示例11: testEntityType

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void testEntityType() throws Exception {
  Edm edm = createEdm();

  assertNotNull(edm);
  FullQualifiedName fqNameEmployee = new FullQualifiedName("RefScenario", "Employee");
  EdmProvider testProvider = new EdmTestProvider();
  EdmImplProv edmImpl = (EdmImplProv) edm;
  EntityType employee = edmImpl.getEdmProvider().getEntityType(fqNameEmployee);
  EntityType testEmployee = testProvider.getEntityType(fqNameEmployee);
  assertEquals(testEmployee.getName(), employee.getName());
  assertEquals(testEmployee.isHasStream(), employee.isHasStream());
  assertEquals(testEmployee.getProperties().size(), employee.getProperties().size());
  assertEquals(testEmployee.getNavigationProperties().size(), employee.getNavigationProperties().size());

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


示例12: append

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
public void append(final XMLStreamWriter writer, final EntityInfoAggregator entityInfo,
    final List<Map<String, Object>> data) throws EntityProviderException {
  try {
    writer.writeStartElement(FormatXml.D_LINKS);
    writer.writeDefaultNamespace(Edm.NAMESPACE_D_2007_08);
    if (properties.getInlineCount() != null) {
      writer.writeStartElement(Edm.PREFIX_M, FormatXml.M_COUNT, Edm.NAMESPACE_M_2007_08);
      writer.writeNamespace(Edm.PREFIX_M, Edm.NAMESPACE_M_2007_08);
      writer.writeCharacters(properties.getInlineCount().toString());
      writer.writeEndElement();
    }
    XmlLinkEntityProducer provider = new XmlLinkEntityProducer(properties);
    for (final Map<String, Object> entityData : data) {
      provider.append(writer, entityInfo, entityData, false);
    }
    writer.writeEndElement();
    writer.flush();
  } catch (final XMLStreamException e) {
    throw new EntityProviderProducerException(EntityProviderException.COMMON, e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:XmlLinksEntityProducer.java


示例13: appendProperty

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
/**
 * 
 * @param writer
 * @param propertyInfo
 * @param value
 * @throws XMLStreamException
 * @throws EdmException
 * @throws EntityProviderException 
 */
private void appendProperty(final XMLStreamWriter writer, final EntityComplexPropertyInfo propertyInfo,
    final Object value) throws XMLStreamException, EdmException, EntityProviderException {

  if (value == null) {
    writer.writeAttribute(Edm.NAMESPACE_M_2007_08, FormatXml.ATOM_NULL, FormatXml.ATOM_VALUE_TRUE);
  } else {
    writer.writeAttribute(Edm.NAMESPACE_M_2007_08, FormatXml.ATOM_TYPE, getFqnTypeName(propertyInfo));
    List<EntityPropertyInfo> propertyInfos = propertyInfo.getPropertyInfos();
    for (EntityPropertyInfo childPropertyInfo : propertyInfos) {
      if (isDataBasedPropertySerialization && !((Map<?,?>)value).containsKey(childPropertyInfo.getName())) {
        continue;
      }
      Object childValue = extractChildValue(value, childPropertyInfo.getName());
      append(writer, childPropertyInfo.getName(), childPropertyInfo, childValue);
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:XmlPropertyEntityProducer.java


示例14: append

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
public void append(final XMLStreamWriter writer, final EntityInfoAggregator entityInfo,
    final Map<String, Object> data, final boolean isRootElement) throws EntityProviderException {
  try {
    writer.writeStartElement(FormatXml.D_URI);
    if (isRootElement) {
      writer.writeDefaultNamespace(Edm.NAMESPACE_D_2007_08);
    }
    if (properties.getServiceRoot() != null) {
      writer.writeCharacters(properties.getServiceRoot().toASCIIString());
    }
    writer.writeCharacters(AtomEntryEntityProducer.createSelfLink(entityInfo, data, null));
    writer.writeEndElement();
    writer.flush();
  } catch (final XMLStreamException e) {
    throw new EntityProviderProducerException(EntityProviderException.COMMON, e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:XmlLinkEntityProducer.java


示例15: test404HttpNotFound

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void test404HttpNotFound() throws Exception {
  when(processor.readEntity(any(GetEntityUriInfo.class), any(String.class))).thenThrow(
      new ODataNotFoundException(ODataNotFoundException.ENTITY));

  final HttpResponse response = executeGetRequest("Managers('199')");
  assertEquals(HttpStatusCodes.NOT_FOUND.getStatusCode(), response.getStatusLine().getStatusCode());

  final String content = StringHelper.inputStreamToString(response.getEntity().getContent());
  Map<String, String> prefixMap = new HashMap<String, String>();
  prefixMap.put("a", Edm.NAMESPACE_M_2007_08);
  XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(prefixMap));
  assertXpathExists("/a:error/a:code", content);
  assertXpathValuesEqual("\"" + MessageService.getMessage(Locale.ENGLISH, ODataNotFoundException.ENTITY).getText()
      + "\"", "/a:error/a:message", content);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:HttpExceptionResponseTest.java


示例16: annotationsAtSimpleProperty

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test
public void annotationsAtSimpleProperty() throws Exception {
  Edm edm = createEdm();
  assertNotNull(edm);
  EdmProperty property = (EdmProperty) edm.getEntityType("Self", "Employee").getProperty("EmployeeName");
  assertNotNull(property);

  EdmAnnotations annotations = property.getAnnotations();
  assertNotNull(annotations);
  List<EdmAnnotationAttribute> annotationAttributes = annotations.getAnnotationAttributes();
  assertNotNull(annotationAttributes);

  List<EdmAnnotationElement> annotationElements = annotations.getAnnotationElements();
  assertNotNull(annotationElements);
  assertEquals(2, annotationElements.size());

  assertNull(annotationElements.get(0).getChildElements());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:EdmxProviderTest.java


示例17: readComplexPropertyWithInvalidChild

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
@Test(expected = EntityProviderException.class)
public void readComplexPropertyWithInvalidChild() throws Exception {
  String xml =
      "<Location xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\""
          + " xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\" m:type=\"RefScenario.c_Location\">" +
          "<Invalid>Germany</Invalid>" +
          "<City m:type=\"RefScenario.c_City\">" +
          "<PostalCode>69124</PostalCode>" +
          "<CityName>Heidelberg</CityName>" +
          "</City>" +
          "</Location>";
  XMLStreamReader reader = createReaderForTest(xml, true);
  final EdmProperty property =
      (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Location");

  new XmlPropertyConsumer().readProperty(reader, property, null);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:XmlPropertyConsumerTest.java


示例18: readCustomizableFeedMappings

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
private CustomizableFeedMappings readCustomizableFeedMappings(final XMLStreamReader reader) {
  String targetPath = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.M_FC_TARGET_PATH);
  String sourcePath = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.M_FC_SOURCE_PATH);
  String nsUri = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.M_FC_NS_URI);
  String nsPrefix = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.M_FC_PREFIX);
  String keepInContent = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.M_FC_KEEP_IN_CONTENT);
  String contentKind = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, XmlMetadataConstants.M_FC_CONTENT_KIND);

  if (targetPath != null || sourcePath != null || nsUri != null || nsPrefix != null || keepInContent != null
      || contentKind != null) {
    CustomizableFeedMappings feedMapping = new CustomizableFeedMappings();
    if (keepInContent != null) {
      feedMapping.setFcKeepInContent("true".equals(keepInContent));
    }
    for (int i = 0; i < EdmContentKind.values().length; i++) {
      if (EdmContentKind.values()[i].name().equalsIgnoreCase(contentKind)) {
        feedMapping.setFcContentKind(EdmContentKind.values()[i]);
      }
    }
    feedMapping.setFcTargetPath(targetPath).setFcSourcePath(sourcePath).setFcNsUri(nsUri).setFcNsPrefix(nsPrefix);
    return feedMapping;
  } else {
    return null;
  }

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


示例19: readLinks

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
/**
 * Reads multiple links with format
 * <pre> {@code
 * <links>
 *  <uri>http://somelink</uri>
 *  <uri>http://anotherLink</uri>
 *  <uri>http://somelink/yetAnotherLink</uri>
 * </links>
 * } </pre>
 * @param reader
 * @param entitySet
 * @return list of string based links
 * @throws EntityProviderException
 */
public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet)
    throws EntityProviderException {
  try {
    List<String> links = new ArrayList<String>();
    reader.nextTag();
    reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS);
    reader.nextTag();
    while (!reader.isEndElement()) {
      if (reader.getLocalName().equals(FormatXml.M_COUNT)) {
        readTag(reader, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT);
      } else {
        final String link = readLink(reader);
        links.add(link);
      }
      reader.nextTag();
    }

    reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS);
    return links;
  } catch (final XMLStreamException e) {
    throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
        .getSimpleName()), e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:39,代码来源:XmlLinkConsumer.java


示例20: readServiceDocument

import org.apache.olingo.odata2.api.edm.Edm; //导入依赖的package包/类
/**
 * @see ServiceDocumentProcessor
 */
@Override
public ODataResponse readServiceDocument(final GetServiceDocumentUriInfo uriInfo, final String contentType)
    throws ODataException {
  final Edm edm = getContext().getService().getEntityDataModel();

  //Service Document has version 1.0 specifically
  if ("HEAD".equals(getContext().getHttpMethod())) {
    return ODataResponse.header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10).build();
  } else {
    final String serviceRoot = getContext().getPathInfo().getServiceRoot().toASCIIString();
    final ODataResponse response = EntityProvider.writeServiceDocument(contentType, edm, serviceRoot);
    return ODataResponse.fromResponse(response)
        .header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10).build();
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:ODataSingleProcessor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ReaderManager类代码示例发布时间:2022-05-23
下一篇:
Java ObjectListImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap