DataSource Class Methods
In this section, the DataSource class methods are presented in alphabetical order.
Syntax
addParameter(DSparam_ID, Value)
Description
Use this method to create a DataSourceParameter object with the given ID and value.
Parameters
Field or Control |
Definition |
---|---|
DSparam_ID |
Specifies the ID of the data source parameter as a string. |
Value |
Specifies the value of the data source parameter as a string. |
Returns
A DataSourceParameter object if successful, false otherwise.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:DataSource:DataSource;
import PTFP_FEED:DataSource:DataSourceParameter;
import PTFP_FEED:UTILITY:Utility;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:DataSource:DataSource &thisDS = &thisFeedFactory.getDataSource("DS_ID");
Local PTFP_FEED:DataSource:DataSourceParameter &thisDSP;
If (&thisDS <> Null) Then
Local PTFP_FEED:UTILITY:Utility &utility = &thisDS.Utility;
&thisDSP = &thisDS.addParameter(&utility.DSPARAMETER_MAXROW, "0");
If (&thisDSP <> Null) Then
&thisDSP.Name = &thisDSP.ID;
&thisDSP.Description = "Description";
&thisDSP.FieldType = &utility.FIELDTYPE_NUMBER;
&thisDSP.DefaultValue = "10";
&thisDSP.Value = &thisDSP.DefaultValue;
&thisDSP.Required = True;
End-If;
End-If;
Syntax
equals(&Object)
Description
Use this method to evaluate the equivalency of an object with the current data source. 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 DataSource object. |
Returns
A Boolean value: True if the items are equivalent, False otherwise.
Syntax
getAttributeById(attribute_ID)
Description
Use this method to return the default feed attribute value of this data type by ID.
Parameters
Field or Control |
Definition |
---|---|
attribute_ID |
Specifies the ID of the attribute as a string. |
Returns
An Attribute object if successful, null otherwise.
Syntax
getContentUrl()
Description
Use this method to return the content URL of the feed as a string.
Parameters
None.
Returns
The content URL of the feed as a string.
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 = &thisFeedFactory.getDataSource("DS_ID");
Local string &FeedContentUrl = "";
If (&thisDS <> Null) Then
&FeedContentUrl = &thisDS.getContentUrl();
End-If;
Syntax
getDataSecurity()
Description
Use this method to return the role- and permission list-based data security as a collection of Authorization objects.
Parameters
None.
Returns
Null if the data security type is public, otherwise a collection of Authorization objects. Each Authorization object represents a role or permission list that has access to the data.
Syntax
getParameterById(DSP_ID)
Description
Use this method to return the DataSourceParameter object with the given ID.
Parameters
Field or Control |
Definition |
---|---|
DSP_ID |
Specifies the ID of the data source parameter as a string. |
Returns
A DataSourceParameter object, null if the data source parameter with the specified ID does not exist.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:DataSource:DataSource;
import PTFP_FEED:DataSource:DataSourceParameter;
import PTFP_FEED:UTILITY:Utility;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:DataSource:DataSource &thisDS = &thisFeedFactory.getDataSource("DS_ID");
Local PTFP_FEED:DataSource:DataSourceParameter &thisDSP;
If (&thisDS <> Null) Then
Local PTFP_FEED:UTILITY:Utility &utility = &thisDS.Utility;
&thisDSP = &thisDS.getParameterById(&utility.DSPARAMETER_MAXROW);
/* Do some processing with the data source parameter here */
End-If;
Syntax
getParameterDetail()
Description
Use this method to return the detailed explanation text of all data source parameters for the specific combination of data source settings.
Parameters
None.
Returns
A string with the detailed explanation text in HTML.
Syntax
getSettingById(DSS_ID)
Description
Use this method to return a DataSourceSetting object for the given ID.
Parameters
Field or Control |
Definition |
---|---|
DSS_ID |
Specifies the ID of the data source setting as a string. |
Returns
A DataSourceSetting object if successful, null if the data source setting with the specified ID does not exist.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:DataSource:DataSource;
import PTFP_FEED:DataSource:DataSourceSetting;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:DataSource:DataSource &thisDS = &thisFeedFactory.getDataSource("DS_ID");
Local PTFP_FEED:DataSource:DataSourceSetting &thisDSS;
If (&thisDS <> Null) Then
&thisDSS = &thisDS.getSettingById("DSS_ID");
/* Do some processing with the data source setting here */
End-If;
Syntax
getSettingDetail()
Description
Use this method to return the detailed explanation text of all data source settings.
Parameters
None.
Returns
A string with the detailed explanation text in HTML.
Syntax
isCurrentUserAdmin()
Description
Use this method to determine whether the current user has administrator access to the feed data.
Parameters
None.
Returns
A Boolean value: True if the user has administrator access, False 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 = &thisFeedFactory.getDataSource("DS_ID");
Local boolean &authorized = False;
If (&thisDS <> Null) Then
&authorized = &thisDS.isCurrentUserAdmin();
/* Do some processing here */
End-If;
Syntax
isCurrentUserAuthorized()
Description
Use this method to determine whether the current user is authorized to view the feed data.
Parameters
None.
Returns
A Boolean value: True if the user is authorized to view the feed data, False 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 = &thisFeedFactory.getDataSource("DS_ID");
Local boolean &authorized = False;
If (&thisDS <> Null) Then
&authorized = &thisDS.isCurrentUserAuthorized();
/* Do some processing here */
End-If;
Syntax
onDelete()
Description
Use this method to update related data prior to deleting a feed definition. Raise an exception to stop the deleting action.
Parameters
None.
Returns
None.
Syntax
onSave()
Description
Use this method to update related data after a feed definition has been saved.
Parameters
None.
Syntax
resetParameters()
Description
Use this method to reset the Parameters collection.
Parameters
None.
Returns
An empty DataSourceParameter collection.
Example
import PTFP_FEED:FeedFactory;
import PTFP_FEED:DataSource:DataSource;
import PTFP_FEED:UTILITY:Collection;
Local PTFP_FEED:FeedFactory &thisFeedFactory = create PTFP_FEED:FeedFactory();
Local PTFP_FEED:DataSource:DataSource &thisDS = &thisFeedFactory.getDataSource("DS_ID");
Local PTFP_FEED:UTILITY:Collection &thisList;
If (&thisDS <> Null) Then
&thisList = &thisDS.resetParameters();
End-If;