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


Java ODataFeed.getEntries方法代码示例

本文整理汇总了Java中org.apache.olingo.odata2.api.ep.feed.ODataFeed.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java ODataFeed.getEntries方法的具体用法?Java ODataFeed.getEntries怎么用?Java ODataFeed.getEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.olingo.odata2.api.ep.feed.ODataFeed的用法示例。


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

示例1: getExpandedData

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
/**
 * @param inlineEntries
 * @param feed
 * @param entry
 */
private void getExpandedData(Map<String, Object> inlineEntries, ODataFeed feed) {
  assertNotNull(feed.getEntries());
  List<ODataEntry> entries = feed.getEntries();
  for (ODataEntry entry : entries) {
    Map<String, ExpandSelectTreeNode> expandNodes = entry.getExpandSelectTree().getLinks();
    for (Entry<String, ExpandSelectTreeNode> expand : expandNodes.entrySet()) {
      assertNotNull(expand.getKey());
      if (inlineEntries.containsKey(expand.getKey() + entry.getMetadata().getId())) {
        if (inlineEntries.get(expand.getKey() + entry.getMetadata().getId()) instanceof ODataFeed) {
          ODataFeed innerFeed = (ODataFeed) inlineEntries.get(expand.getKey() + entry.getMetadata().getId());
          assertNotNull(innerFeed);
          getExpandedData(inlineEntries, innerFeed);
          feed.getEntries().get(feed.getEntries().indexOf(entry)).getProperties().put(expand.getKey(), innerFeed);
        } else if (inlineEntries.get(expand.getKey() + entry.getMetadata().getId()) instanceof ODataEntry) {
          ODataEntry innerEntry = (ODataEntry) inlineEntries.get(expand.getKey() + entry.getMetadata().getId());
          assertNotNull(innerEntry);
          getExpandedData(inlineEntries, innerEntry);
          feed.getEntries().get(feed.getEntries().indexOf(entry)).getProperties().put(expand.getKey(), innerEntry);
        }
      }
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:29,代码来源:JsonFeedConsumerTest.java

示例2: roomsFeedWithEtagEntries

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void roomsFeedWithEtagEntries() throws Exception {
  InputStream stream = getFileAsStream("feed_rooms_small.xml");
  assertNotNull(stream);

  ODataFeed feed =
      EntityProvider.readFeed("application/atom+xml", MockFacade.getMockEdm().getDefaultEntityContainer()
          .getEntitySet(
              "Rooms"), stream, DEFAULT_PROPERTIES);
  assertNotNull(feed);

  FeedMetadata feedMetadata = feed.getFeedMetadata();
  assertNotNull(feedMetadata);
  assertNotNull(feedMetadata.getNextLink());

  List<ODataEntry> entries = feed.getEntries();
  assertEquals(3, entries.size());
  ODataEntry singleRoom = entries.get(0);
  EntryMetadata roomMetadata = singleRoom.getMetadata();
  assertNotNull(roomMetadata);

  assertEquals("W/\"1\"", roomMetadata.getEtag());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:XmlFeedConsumerTest.java

示例3: innerFeedNoMediaResourceWithCallbackContainsNextLinkAndCount

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void innerFeedNoMediaResourceWithCallbackContainsNextLinkAndCount() throws Exception {
  ODataEntry outerEntry =
      prepareAndExecuteEntry(BUILDING_WITH_INLINE_ROOMS_NEXTLINK_AND_COUNT, "Buildings", DEFAULT_PROPERTIES);

  ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
  assertNotNull(innerRoomFeed);

  List<ODataEntry> rooms = innerRoomFeed.getEntries();
  assertNotNull(rooms);
  assertEquals(1, rooms.size());

  FeedMetadata roomsMetadata = innerRoomFeed.getFeedMetadata();
  assertEquals(Integer.valueOf(1), roomsMetadata.getInlineCount());
  assertEquals("nextLink", roomsMetadata.getNextLink());

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

示例4: emptyFeed

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void emptyFeed() throws Exception {
  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
  String content = "{\"d\":{\"results\":[]}}";
  InputStream contentBody = createContentAsStream(content);

  // execute
  JsonEntityConsumer xec = new JsonEntityConsumer();
  ODataFeed feed = xec.readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
  assertNotNull(feed);

  List<ODataEntry> entries = feed.getEntries();
  assertNotNull(entries);
  assertEquals(0, entries.size());

  FeedMetadata feedMetadata = feed.getFeedMetadata();
  assertNotNull(feedMetadata);
  assertNull(feedMetadata.getInlineCount());
  assertNull(feedMetadata.getNextLink());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:JsonFeedConsumerTest.java

示例5: testRead

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void testRead() throws Exception {
    final Map<String, Object> headers = new HashMap<String, Object>();

    // read ServiceDocument
    final ServiceDocument document = requestBodyAndHeaders("direct://READSERVICEDOC", null, headers);
    assertNotNull(document);
    assertFalse("ServiceDocument entity sets", document.getEntitySetsInfo().isEmpty());
    LOG.info("Service document has {} entity sets", document.getEntitySetsInfo().size());

    // parameter type is java.util.Map
    final HashMap<String, String> queryParams = new HashMap<String, String>();
    queryParams.put(SystemQueryOption.$top.name(), "5");
    headers.put("CamelOlingo2.queryParams", queryParams);

    // read ODataFeed
    final ODataFeed manufacturers = requestBodyAndHeaders("direct://READFEED", null, headers);
    assertNotNull(manufacturers);
    final List<ODataEntry> manufacturersEntries = manufacturers.getEntries();
    assertFalse("Manufacturers empty entries", manufacturersEntries.isEmpty());
    LOG.info("Manufacturers feed has {} entries", manufacturersEntries.size());

    // read ODataEntry
    headers.clear();
    headers.put(Olingo2Constants.PROPERTY_PREFIX + "keyPredicate", "'1'");
    final ODataEntry manufacturer = requestBodyAndHeaders("direct://READENTRY", null, headers);
    assertNotNull(manufacturer);
    final Map<String, Object> properties = manufacturer.getProperties();
    assertEquals("Manufacturer Id", "1", properties.get(ID_PROPERTY));
    LOG.info("Manufacturer: {}", properties.toString());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:32,代码来源:Olingo2ComponentTest.java

示例6: prettyPrint

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
private static String prettyPrint(ODataFeed dataFeed) {
    StringBuilder builder = new StringBuilder();
    builder.append("[\n");
    for (ODataEntry entry : dataFeed.getEntries()) {
        builder.append(prettyPrint(entry.getProperties(), 1)).append('\n');
    }
    builder.append("]\n");
    return builder.toString();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:Olingo2AppAPITest.java

示例7: readTicketById

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
public Ticket readTicketById(String ticketId) throws IOException,
		ODataException {

	List<Ticket> tickets = new ArrayList<Ticket>();

	String serviceUrl = getODataServiceUrl();

	SystemQueryOptions queryOptions = this.new SystemQueryOptions();
	String queryString = new StringBuffer(
			"?$format=json&$expand=ServiceRequestDescription&$filter=ObjectID%20eq%20%27")
			.append(ticketId).append("%27").toString();
	queryOptions.setQueryCondition(queryString);

	ODataFeed feed = readFeed(serviceUrl, APPLICATION_JSON,
			"ServiceRequestCollection", queryOptions);

	logger.info("Read: " + feed.getEntries().size() + " entries");

	for (ODataEntry entry : feed.getEntries()) {
		tickets.add(mapEntryToTicket(entry));
	}

	if (tickets.size() > 1) {
		// Should be an error !!
	}

	Ticket result = tickets.get(0);

	return tickets.get(0);
}
 
开发者ID:SAP,项目名称:C4CODATAAPIDEVGUIDE,代码行数:31,代码来源:ServiceTicketODataConsumer.java

示例8: innerFeedNoMediaResourceWithCallback

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void innerFeedNoMediaResourceWithCallback() throws Exception {
  FeedCallback callback = new FeedCallback();
  EntityProviderReadProperties readProperties =
      EntityProviderReadProperties.init().mergeSemantic(false).callback(callback).build();
  ODataEntry outerEntry = prepareAndExecuteEntry(BUILDING_WITH_INLINE_ROOMS, "Buildings", readProperties);

  ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
  assertNull(innerRoomFeed);

  innerRoomFeed = callback.getFeed();

  List<ODataEntry> rooms = innerRoomFeed.getEntries();
  assertNotNull(rooms);
  assertEquals(1, rooms.size());

  ODataEntry room = rooms.get(0);
  Map<String, Object> roomProperties = room.getProperties();

  assertEquals(4, roomProperties.size());
  assertEquals("1", roomProperties.get("Id"));
  assertEquals("Room 1", roomProperties.get("Name"));
  assertEquals(Short.valueOf("1"), roomProperties.get("Version"));
  assertEquals(Short.valueOf("1"), roomProperties.get("Seats"));

  List<String> associationUris = room.getMetadata().getAssociationUris("nr_Employees");
  assertEquals(1, associationUris.size());
  assertEquals("http://localhost:8080/ReferenceScenario.svc/Rooms('1')/nr_Employees", associationUris.get(0));

  associationUris = room.getMetadata().getAssociationUris("nr_Building");
  assertEquals(1, associationUris.size());
  assertEquals("http://localhost:8080/ReferenceScenario.svc/Rooms('1')/nr_Building", associationUris.get(0));
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:34,代码来源:JsonEntryDeepInsertFeedTest.java

示例9: teamsFeedWithCountWithoutD

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void teamsFeedWithCountWithoutD() throws Exception {
  ODataFeed feed = prepareAndExecuteFeed("JsonTeamsWithCountWithoutD.json", "Teams", DEFAULT_PROPERTIES);

  List<ODataEntry> entries = feed.getEntries();
  assertNotNull(entries);
  assertEquals(2, entries.size());

  // Check FeedMetadata
  FeedMetadata feedMetadata = feed.getFeedMetadata();
  assertNotNull(feedMetadata);
  assertEquals(Integer.valueOf(3), feedMetadata.getInlineCount());
  assertNull(feedMetadata.getNextLink());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:15,代码来源:JsonFeedConsumerTest.java

示例10: innerFeedMediaResourceWithCallback

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void innerFeedMediaResourceWithCallback() throws Exception {
  ODataEntry outerEntry = prepareAndExecuteEntry(TEAM_WITH_INLINE_EMPLOYEES, "Teams", DEFAULT_PROPERTIES);

  ODataFeed innerEmployeeFeed = (ODataFeed) outerEntry.getProperties().get("nt_Employees");
  assertNotNull(innerEmployeeFeed);

  List<ODataEntry> employees = innerEmployeeFeed.getEntries();
  assertNotNull(employees);
  assertEquals(3, employees.size());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:12,代码来源:JsonEntryDeepInsertFeedTest.java

示例11: innerFeedMediaResourceWithoutCallback

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void innerFeedMediaResourceWithoutCallback() throws Exception {
  ODataEntry outerEntry = prepareAndExecuteEntry(TEAM_WITH_INLINE_EMPLOYEES, "Teams", DEFAULT_PROPERTIES);

  ODataFeed innerEmployeeFeed = (ODataFeed) outerEntry.getProperties().get("nt_Employees");
  assertNotNull(innerEmployeeFeed);

  List<ODataEntry> employees = innerEmployeeFeed.getEntries();
  assertNotNull(employees);
  assertEquals(3, employees.size());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:12,代码来源:JsonEntryDeepInsertFeedTest.java

示例12: innerFeedNoMediaResourceWithoutCallbackSimpleArray

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void innerFeedNoMediaResourceWithoutCallbackSimpleArray() throws Exception {
  EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Buildings");
  String content = "{\"d\":{\"Id\":\"1\",\"Name\":\"Building 1\","
      + "\"nb_Rooms\":[{\"Id\":\"1\",\"Name\":\"Room 1\"}]}}";
  InputStream contentBody = createContentAsStream(content);
  final ODataEntry outerEntry = new JsonEntityConsumer().readEntry(entitySet, contentBody, DEFAULT_PROPERTIES);
  assertNotNull(outerEntry);
  final ODataFeed innerRoomFeed = (ODataFeed) outerEntry.getProperties().get("nb_Rooms");
  assertNotNull(innerRoomFeed);

  final List<ODataEntry> rooms = innerRoomFeed.getEntries();
  assertNotNull(rooms);
  assertEquals(1, rooms.size());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:16,代码来源:JsonEntryDeepInsertFeedTest.java

示例13: emptyFeedWithoutDAndResults

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void emptyFeedWithoutDAndResults() throws Exception {
  final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
  InputStream contentBody = createContentAsStream("[]");
  final ODataFeed feed = new JsonEntityConsumer().readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
  assertNotNull(feed);
  final List<ODataEntry> entries = feed.getEntries();
  assertNotNull(entries);
  assertEquals(0, entries.size());
  final FeedMetadata feedMetadata = feed.getFeedMetadata();
  assertNotNull(feedMetadata);
  assertNull(feedMetadata.getInlineCount());
  assertNull(feedMetadata.getNextLink());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:15,代码来源:JsonFeedConsumerTest.java

示例14: emptyFeedWithoutResults

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void emptyFeedWithoutResults() throws Exception {
  final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
  InputStream contentBody = createContentAsStream("{\"d\":[]}");
  final ODataFeed feed = new JsonEntityConsumer().readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
  assertNotNull(feed);
  final List<ODataEntry> entries = feed.getEntries();
  assertNotNull(entries);
  assertEquals(0, entries.size());
  final FeedMetadata feedMetadata = feed.getFeedMetadata();
  assertNotNull(feedMetadata);
  assertNull(feedMetadata.getInlineCount());
  assertNull(feedMetadata.getNextLink());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:15,代码来源:JsonFeedConsumerTest.java

示例15: teamsFeedWithCount

import org.apache.olingo.odata2.api.ep.feed.ODataFeed; //导入方法依赖的package包/类
@Test
public void teamsFeedWithCount() throws Exception {
  ODataFeed feed = prepareAndExecuteFeed("JsonTeamsWithCount.json", "Teams", DEFAULT_PROPERTIES);

  List<ODataEntry> entries = feed.getEntries();
  assertNotNull(entries);
  assertEquals(2, entries.size());

  // Check FeedMetadata
  FeedMetadata feedMetadata = feed.getFeedMetadata();
  assertNotNull(feedMetadata);
  assertEquals(Integer.valueOf(3), feedMetadata.getInlineCount());
  assertNull(feedMetadata.getNextLink());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:15,代码来源:JsonFeedConsumerTest.java


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