Feed Class Methods
In this section, the Feed class methods are presented in alphabetical order.
Syntax
delete()
Description
Use this method to delete a feed definition from the database.
Parameters
None.
Returns
A Boolean value: True if the deletion was successful, False otherwise.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
Local boolean &succeed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DELETION);
If &thisFeed <> Null And
&thisFeed.Authorized Then
&succeed = &thisFeed.delete();
End-If;
Syntax
equals(&Object)
Description
Use this method to evaluate the equivalency of an object with the current feed. Equivalency is established based on the value of two properties: the object's ID and the ObjectType.
Parameters
Field or Control |
Definition |
---|---|
&Object |
Specifies the object to be compared to the current Feed object. |
Returns
A Boolean value: True if the items are equivalent, False otherwise.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed1 = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:Feed &thisFeed2 = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
If &thisFeed1.equals(&thisFeed2) Then
/* Do some process */
End-If;
Syntax
execute()
Description
Use this method to execute the current feed definition to get a FeedDoc object.
Parameters
None.
Returns
A FeedDoc object.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:XML_FEED:FeedDoc;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_EXECUTION);
Local PTFP_FEED:XML_FEED:FeedDoc &thisFeedDoc;
If &thisFeed <> Null Then
&thisFeed.populatePrefData( Null);
&thisFeedDoc = &thisFeed.execute();
End-If;
Syntax
getAttribute(attribute_ID)
Description
Use this method to get a feed attribute by ID.
Parameters
Field or Control |
Definition |
---|---|
attribute_ID |
Specifies the ID of the Attribute object as a string. |
Returns
A feed Attribute object.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:UTILITY:Attribute;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:UTILITY:Attribute &logo;
If &thisFeed <> Null Then
&logo = &thisFeed.getAttribute(&thisFeedFactory.Utility.FEEDATTRIBUTE_LOGOURL);
End-If;
Syntax
load()
Description
Use this method to load the feed definition from the database.
Parameters
None.
Returns
A Boolean value: True if the feed definition was loaded successfully, False 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.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
If &thisFeed <> Null Then
&succeed = &thisFeed.load();
End-If;
Syntax
loadFromTemplate(template_ID)
Description
Use this method to load the specified feed template definition from the database.
Parameters
Field or Control |
Definition |
---|---|
template_ID |
Specifies the feed template ID as a string. |
Returns
A Boolean value: True if the feed template definition was loaded successfully, False 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.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
If &thisFeed <> Null Then
&succeed = &thisFeed.loadFromTemplate("template_ID");
End-If;
Syntax
PopulateDSParamsWithDefaults()
Description
Use this method to populate the data source parameter collection for this feed with default values only.
Parameters
None.
Returns
None.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:EXCEPTION:FeedException;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
/* Reset the Data Source Parameters of the Feed to their defaults. */
try
&thisFeed.PopulateDSParamsWithDefaults();
catch PTFP_FEED:EXCEPTION:FeedException &ex;
end-try;
Syntax
populatePrefData(&FeedRequest)
Description
Use this method to populate the administrator- or user-specified data source parameter values from the feed definition or from the feed request if parameters are specified there.
Parameters
Field or Control |
Definition |
---|---|
&FeedRequest |
Specifies a FeedRequest object. |
Returns
None.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:XML_FEED:FeedDoc;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_EXECUTION);
Local PTFP_FEED:XML_FEED:FeedDoc &thisFeedDoc;
If &thisFeed <> Null Then
&thisFeed.populatePrefData( Null);
&thisFeedDoc = &thisFeed.execute();
End-If;
Syntax
publishToSites(Sites)
Description
Use this method to publish the feed definition to the specified sites.
Parameters
Field or Control |
Definition |
---|---|
Sites |
Specifies as an array of string the list of sites to which to publish the feed definition. |
Returns
None.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
If &thisFeed <> Null Then
&thisFeed.publishToSites(CreateArray("EMPLOYEE", "CUSTOMER"));
End-If;
Syntax
resetFeedAttributes()
Description
Use this method to reset the FeedAttributes collection.
Parameters
None.
Returns
An empty FeedAttributes collection.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:UTILITY:Collection;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:UTILITY:Collection &coll;
If &thisFeed <> Null Then
&coll = &thisFeed.resetFeedAttributes();
End-If;
Syntax
resetFeedSecurities()
Description
Use this method to reset the FeedSecurities collection.
Parameters
None.
Returns
An empty FeedSecurities collection.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:UTILITY:Collection;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:UTILITY:Collection &coll;
If &thisFeed <> Null Then
&coll = &thisFeed.resetFeedSecurities();
End-If;
Syntax
save()
Description
Use this method to save the feed definition to the database.
Parameters
None.
Returns
A Boolean value: True if the save was successful, False otherwise.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:UTILITY:Attribute;
Local boolean &succeed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:UTILITY:Attribute &logo;
If &thisFeed <> Null Then
&logo = &thisFeed.setAttribute(&thisFeedFactory.Utility.FEEDATTRIBUTE_LOGOURL, "", "http://example.com/logo.jpg");
&succeed = &thisFeed.save();
End-If;
Syntax
saveAs(new_ID, CopyPrefData)
Description
Use this method to save the feed definition to the database using the given new ID.
Parameters
Field or Control |
Definition |
---|---|
new_ID |
Specifies the new feed ID as a string. |
CopyPrefData |
Specifies as a Boolean value whether to copy administrator and user personalization data. |
Returns
A new Feed object.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
Local boolean &succeed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:Feed &newFeed;
If &thisFeed <> Null Then
&newFeed = &thisFeed.saveAs("new_feed_id", True);
End-If;
Syntax
saveAsTemplate(new_ID, CopyPrefData)
Description
Use this method to save the feed definition to the database as a feed template definition using the given new ID.
Parameters
Field or Control |
Definition |
---|---|
new_ID |
Specifies the new feed template ID as a string. |
CopyPrefData |
Specifies as a Boolean value whether to copy administrator and user personalization data. |
Returns
A Boolean value: True if the save was successful, False otherwise.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
Local boolean &succeed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:Feed &newFeed;
If &thisFeed <> Null Then
&newFeed = &thisFeed.saveAsTemplate("new_feed_template_id", True);
End-If;
Syntax
setAttribute(attribute_ID, Value, XML)
Description
Use this method to set the properties of a feed attribute. If the attribute ID does not exist, then a new attribute is created. If both Value and XML are empty, the attribute is deleted.
Parameters
Field or Control |
Definition |
---|---|
attribute_ID |
Specifies the ID of the attribute as a string. |
Value |
Specifies the value of the attribute as a string. Use Value for translatable values such as the copyright and so on. |
XML |
Specifies the XML value of the attribute as a string. Use XML for nontranslatable values or values longer than 254 characters such as a URL. |
Returns
An Attribute object.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:UTILITY:Attribute;
Local boolean &succeed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
Local PTFP_FEED:UTILITY:Attribute &logo;
If &thisFeed <> Null Then
&logo = &thisFeed.setAttribute(&thisFeedFactory.Utility.FEEDATTRIBUTE_LOGOURL, "", "http://example.com/logo.jpg");
&succeed = &thisFeed.save();
End-If;
Syntax
setDataSourceById(DataType_ID)
Description
Use this method to set the data source for the Feed object by data type ID.
Parameters
Field or Control |
Definition |
---|---|
DataType_ID |
Specifies the data type ID to set as the data source. |
Returns
A DataSource object if successful, null otherwise.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
import PTFP_FEED:DataSource:DataSource;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.createFeed("feed_ID");
Local PTFP_FEED:DataSource:DataSource &thisDS;
&thisDS = &thisFeed.setDataSourceByID("FEED");
Syntax
unpublishFromSites(Sites)
Description
Use this method to remove the published feed definition from the specified sites.
Parameters
Field or Control |
Definition |
---|---|
Sites |
Specifies as an array of string the list of sites from which the feed definition is to be removed. |
Returns
None.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:Feed;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:Feed &thisFeed = &thisFeedFactory.getFeed("feed_ID", &thisFeedFactory.Utility.OPERATINGMODE_DEFAULT);
If &thisFeed <> Null Then
&thisFeed.unpublishFromSites(CreateArray("EMPLOYEE", "CUSTOMER"));
End-If;