FeedFactory Class Methods

In this section, the FeedFactory class methods are presented in alphabetical order.

Syntax

convertFeedLinksToHoverMenu(&Links, Flat)

Description

Use this method to convert a feed Link collection to a HoverMenu object.

Parameters

Field or Control

Definition

&Links

Specifies the feed links as a Link collection.

Flat

A Boolean value that indicates whether to organize links in subfolders based on their categories (False), or into a root folder if there are no categories (True). The default value is False.

Returns

A HoverMenu object if successful.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:SearchRequest;
import PTFP_FEED:UTILITY:Collection;
import PTFP_FEED:UTILITY:HoverMenu;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:Collection &results;
Local PTFP_FEED:UTILITY:SearchRequest &request;
Local PTFP_FEED:UTILITY:HoverMenu &menu;

&request = create PTFP_FEED:UTILITY:SearchRequest("SearchResults");
&request.PortalName = %Portal;
&results = &thisFeedFactory.getFeedLinks(&request);
&menu = &thisFeedFactory.convertFeedLinksToHoverMenu(&results, True);

Syntax

convertFeedLinksToOPML(&Links, Flat)

Description

Use this method to convert a feed Link collection to an OPMLDoc object.

Parameters

Field or Control

Definition

&Links

Specifies the feed links as a Link collection.

Flat

A Boolean value that indicates whether to organize links in subfolders based on their categories (False), or into a root folder if there are no categories (True). The default value is False.

Returns

An OPMLDoc object if successful.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:SearchRequest;
import PTFP_FEED:UTILITY:Collection;
import PTFP_FEED:XML_OPML:OPMLDoc;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:Collection &results;
Local PTFP_FEED:UTILITY:SearchRequest &request;
Local PTFP_FEED:XML_OPML:OPMLDoc &opmlDoc;

&request = create PTFP_FEED:UTILITY:SearchRequest("SearchResults");
&request.PortalName = %Portal;
&results = &thisFeedFactory.getFeedLinks(&request);
&opmlDoc = &thisFeedFactory.convertFeedLinksToOPML(&results, True);

Syntax

createFeed(feed_ID)

Description

Use this method to create a new Feed object with the given ID.

Parameters

Field or Control

Definition

feed_ID

Specifies the feed ID of the new feed definition.

Returns

A Feed object if successful, null otherwise.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.createFeed("feed_ID");

Syntax

deleteFeed(feed_ID)

Description

Use this method to delete the feed definition.

Parameters

Field or Control

Definition

feed_ID

Specifies the feed definition to be deleted.

Returns

A Boolean value: True if the feed deletion was successful, False otherwise.

Example

import PTFP_FEED:FeedFactory;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local boolean &succeed = &thisFeedFactory.deleteFeed("feed_ID");

Syntax

genFeedUrl(feed_ID, OperationName, SecurityType)

Description

Use this method to generate the feed URL based on the feed ID and Integration Broker service operation name. If the service operation name is empty, the default service operation, PTFP_GETFEED, is used.

Parameters

Field or Control

Definition

feed_ID

Specifies the ID for the feed definition as a string.

OperationName

Specifies the Integration Broker service operation name as a string. The default service operation is PTFP_GETFEED.

SecurityType

Specifies the security type for the feed as a string.

Returns

A feed URL as a string.

Example

import PTFP_FEED:FeedFactory;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local string &url = &thisFeedFactory.genFeedUrl("feed_ID", "PTFP_GETFEED", &thisFeedFactory.Utility.FEEDSECUTYPE_PUBLIC);

Syntax

genUniqueFeedId(seed)

Description

Use this method to generate an unique feed ID from the specified seed string.

Parameters

Field or Control

Definition

seed

Specifies the seed as a string.

Returns

A feed ID as a string.

Example

import PTFP_FEED:FeedFactory;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local string &id = &thisFeedFactory.genUniqueFeedId("feed_ID");

Syntax

getAllPagedFeedLinks(feed_ID, fromDTTM, allLanguages) 

Description

Use this method to get all the paged feed URLs for the specified scheduled feed definition starting from the specified date and time. If allLanguages is set to True, then feed URLs corresponding to all languages are also provided.

This method returns an array of paged feed URLs; each URL represents a specific page (message segment) of the paged feed.

Note: This method is supported for scheduled feeds only.

Related Links

Paged Feeds

Parameters

Field or Control

Definition

feed_ID

Specifies the ID for the scheduled feed definition as a string.

fromDTTM

Specifies the start date and time as a DateTime value.

allLanguages

A Boolean value that indicates whether to provide paged feed URLs for all languages.

Returns

An array of string.

Example

import PTFP_FEED:FeedFactory;

Local PTFP_FEED:FeedFactory &feedFactory_inst;
Local datetime &fromDttm;
Local array of string &feedLinks;

&feedFactory_inst = create PTFP_FEED:FeedFactory();
&fromDttm = DateTimeValue("01/01/1900 00:00:00");
&feedLinks = &feedFactory_inst.getAllPagedFeedLinks("ADMN_USER_PROFILE", &fromDttm, True);

Syntax

getCategory(category_ID, ActiveOnly)

Description

Use this method to retrieve all of the category information for a category ID. The information is returned as an array of string with four elements.

Parameters

Field or Control

Definition

category_ID

Specifies the category ID as a string.

ActiveOnly

Indicates as a Boolean value whether to retrieve the description only if the category is active.

Returns

An array of string with four elements:

  • Category ID

  • Short description

  • Long description

  • Status

Example

import PTFP_FEED:FeedFactory;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local array of string &catagories = &thisFeedFactory.getCategory("category_ID", True);

Syntax

getDataSource(DataType_ID)

Description

Use this method to create a DataSource object with the given data type ID.

Parameters

None.

Field or Control

Definition

DataType_ID

Specifies the data type ID for the data source, as a string.

Returns

A DataSource object if successful, null otherwise.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:DataSource:DataSource;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:DataSource:DataSource &thisDS;

&thisDS = &thisFeedFactory.getDataSource("FEED");

Syntax

getFeed(feed_ID, mode)

Description

Use this method to create a Feed object with the given feed ID.

Parameters

Field or Control

Definition

feed_ID

Specifies the feed ID as a string.

mode

Specifies the operating mode for the feed as a number. See the values below.

The values for the mode parameter are:

Numeric Value

Constant Value

Description

0

&utility.OPERATINGMODE_DEFAULT

A Feed object in this mode allows all operations such as save, delete, and so on.

10

&utility.OPERATINGMODE_EXECUTION

A Feed object in this mode is for execution to get the feed document. Other operations such as save and delete are not allowed.

11

&utility.OPERATINGMODE_EXECUTION_NOENTRY

A Feed object in this mode is for execution to get a feed document with just an empty feed header (that is, without feed entries). Otherwise, this mode is the same as the OPERATINGMODE_EXECUTION mode.

100

&utility.OPERATINGMODE_AUTHORIZATION

A Feed object in this mode is for validating user access to the feed. Most other operations such as execute, save, and delete are not allowed.

1000

&utility.OPERATINGMODE_DELETION

A Feed object in this mode is to delete the feed definition. Most other operations such as execute and save are not allowed.

Returns

A Feed object if successful, null otherwise.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed;

&thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);

Syntax

getFeedDoc(&feedRequest)

Description

Use this method to get the feed document of the feed specified by the FeedRequest object.

Parameters

Field or Control

Definition

&feedRequest

Specifies the feed request as a FeedRequest object.

Returns

A FeedDoc object if successful, null otherwise.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:XML_FEED:FeedDoc;
import PTFP_FEED:UTILITY:FeedRequest;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:FeedRequest &request;
Local PTFP_FEED:XML_FEED:FeedDoc &thisFeedDoc;

&request = create PTFP_FEED:UTILITY:FeedRequest("FeedRequest");
&request.FeedID = "feed_ID";
&thisFeedDoc = &thisFeedFactory.getFeedDoc(&request);

Syntax

getFeedLink(feed_ID)

Description

Use this method to create a Link object for the specified feed ID.

Parameters

Field or Control

Definition

feed_ID

Specifies the feed ID as a string.

Returns

A Link object if successful, null otherwise.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:Link;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:Link &thisFeedLink;

&thisFeedLink = &thisFeedFactory.getFeedLink("feed_ID");

Syntax

getFeedLinks(&searchRequest)

Description

Use this method to search feed definitions based on user permissions and the search criteria specified in the SearchRequest object. The method returns a collection of feed Link objects. The list is sorted by the feed definition's last updated time by default.

Parameters

Field or Control

Definition

&searchRequest

Specifies the search criteria as a SearchRequest object.

Returns

A Link collection.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:SearchRequest;
import PTFP_FEED:UTILITY:Collection;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:Collection &results;
Local PTFP_FEED:UTILITY:SearchRequest &request;

&request = create PTFP_FEED:UTILITY:SearchRequest("SearchResults");
&request.PortalName = %Portal;
&results = &thisFeedFactory.getFeedLinks(&request);

Syntax

getFeedTemplates(&searchRequest)

Description

Use this method to search feed template definitions based on user permissions and the search criteria specified in the SearchRequest object. The method returns a collection of feed template definitions. The list is sorted by the feed template definition's last updated time by default.

Parameters

Field or Control

Definition

&searchRequest

Specifies the search criteria as a SearchRequest object.

Returns

A collection of Feed objects.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:SearchRequest;
import PTFP_FEED:UTILITY:Collection;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:SearchRequest &request;
Local PTFP_FEED:UTILITY:Collection &feedTemplates;
Local array of string &thisDSS;

&request = create PTFP_FEED:UTILITY:SearchRequest("SearchResults");
&request.DataTypeID = "datatype_id";
&thisDSS = CreateArray("datasourcesetting_name", "datasourcesetting_value");
&request.DataSourceSettings.Push(&thisDSS);
&feedTemplates = &PTFP_FEED_FACTORY.getFeedTemplates(&request);

Syntax

getRelatedFeedsHoverMenu(&Requests)

Description

Use this method to create a related feeds HoverMenu object from the specified FeedRequest objects.

Parameters

Field or Control

Definition

&Requests

Specifies the related feeds requests as an array of RelatedFeedsRequest objects.

Returns

A HoverMenu object.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:RelatedFeedsRequest;
import PTFP_FEED:UTILITY:HoverMenu;
import PTFP_FEED:UTILITY:Collection;

Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:UTILITY:Collection &results;
Local PTFP_FEED:UTILITY:RelatedFeedsRequest &request;
Local PTFP_FEED:UTILITY:HoverMenu &menu;

&request = create PTFP_FEED:UTILITY:RelatedFeedsRequest("FEED");
&request.DataTypeID = "FEED";
&menu = &thisFeedFactory.getRelatedFeedsHoverMenu(CreateArray(&request));

Syntax

getRelativePageLinkForFeed(feed_ID, currentFeedURL, linkOption, fromDTTM) 

Description

Use this method to get the specified relative paged feed URL (first, previous, next or last) for the current paged feed URL.

This method returns a paged feed URL as a string.

Note: This method is supported for scheduled feeds only.

Related Links

Paged Feeds

Parameters

Field or Control

Definition

feed_ID

Specifies the ID for the scheduled feed definition as a string.

currentFeedURL

Specifies the paged feed URL for the current page as a string.

linkOption

Specifies which page link as a string. See the values below.

fromDTTM

Specifies the start date and time as a DateTime value.

Value

Description

&utlity.LINKTYPE_FIRST

Indicates the first page of the paged feed.

&utlity.LINKTYPE_PREVIOUS

Indicates the previous page of the paged feed.

&utlity.LINKTYPE_NEXT

Indicates the next page of the paged feed.

&utlity.LINKTYPE_LAST

Indicates the last page of the paged feed.

Returns

A string.

Example

import PTFP_FEED:FeedFactory;
import PTFP_FEED:UTILITY:Utility;
import PTFP_FEED:UTILITY:Link;

Local PTFP_FEED:FeedFactory &feedFactory_inst;
Local PTFP_FEED:UTILITY:Utility &utility;
Local PTFP_FEED:UTILITY:Link &link;

Local datetime &fromDttm;
Local string &feedLink, &nextFeedLink, &prevFeedLink, &firstFeedLink, &lastFeedLink;

&feedFactory_inst = create PTFP_FEED:FeedFactory();
&utility = &feedFactory_inst.Utility;
&fromDttm = DateTimeValue("01/01/1900 00:00:00");
&link = &feedFactory_inst.getFeedLink("ADMN_USER_PROFILE");
If All(&link) Then
   &feedLink = &link.Href;
   
   &nextFeedLink = &feedFactory_inst.getRelativePageLinkForFeed("ADMN_USER_PROFILE", &feedLink, &utility.LINKTYPE_NEXT, &fromDttm);
   &prevFeedLink = &feedFactory_inst.getRelativePageLinkForFeed("ADMN_USER_PROFILE", &feedLink, &utility.LINKTYPE_PREVIOUS, &fromDttm);
   &firstFeedLink = &feedFactory_inst.getRelativePageLinkForFeed("ADMN_USER_PROFILE", &feedLink, &utility.LINKTYPE_FIRST, &fromDttm);
   &lastFeedLink = &feedFactory_inst.getRelativePageLinkForFeed("ADMN_USER_PROFILE", &feedLink, &utility.LINKTYPE_LAST, &fromDttm);
End-If;