Show TOC

Implementing a Custom Feed ViewerLocate this document in the navigation structure

Use

In the portal, SAP provides the Enterprise Feed iView that you can use to display a single enterprise feed.

You can also implement a custom feed viewer that displays, for example, multiple enterprise feeds.

The IFeedsService interface provides the following method for retrieving the entries from one or more feeds:
public IFeedEntries getFeedEntries(
	String[] feedIDs,
	IPortalComponentRequest request,
	Map<Object, Object> additionalParams)
	throws FeedsAggregationException;
Note

You can obtain the feed ID in the Portal Catalog (Content Administration), by selecting Copy ID from the context menu of the enterprise feed.

From an IFeedEntries object, you can retrieve all the entries returned by all channels in the enterprise feeds as a single list, using the getEntries method; or you can retrieve the entries by groups using the getEntriesByGroup method.

When retrieving the entries by groups, the configuration of the enterprise feeds determines how the entries are grouped. For an enterprise feed with the By Channel display mode, a separate entry group is created for the entries of each channel, while for an enterprise feed with the Flat List display mode, a single entry group is created for all entries of all channels.

Prerequisites
  • You have a runtime reference to the feeds public API façade.

    For example, in the portalapp.xml descriptor, use the following reference:

    com.sap.tc~ep.ext~feeds~facade

  • Enterprise feeds have been created by the content administrator.

Example

The following sample shows how to retrieve entries and errors by groups, from two feeds.

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
	IFeedsService feedsService = (IFeedsService) PortalRuntime.getRuntimeResources().getService(IFeedsService.KEY);
	String feedID_1 = "portal_content/myFeeds/feed_1";
	String feedID_2 = "portal_content/myFeeds/feed_2";
	Map additionalParameters = null;
	try {
		/** Retrieve an IFeedEntries object that contains all feed entries and any errors that occurred **/
		IFeedEntries feedEntries = feedsService.getFeedEntries(feedIDs, request, additionalParameters);

		/** Retrieve the entries as IEntryGroup objects that contain entries and errors. **/
		for (IEntryGroup entriesByGroup : feedEntries.getEntriesByGroup()) {
			entriesByGroup.getEntries();
			entriesByGroup.getExceptions();
		}
	}
	catch (FeedsAggregationException e) {
		/** Error handling **/
	}
}
More Information