JSDO properties, methods, and events reference : getPlugin( ) method
  

getPlugin( ) method

Note: Applies to Progress Data Objects Version 4.3 or later.
Returns a reference to the registered JSDO plugin object with the specified name.
Return type: Object
Applies to: progress.data.PluginManager class

Syntax

progress.data.PluginManager.getPlugin( name )
name
A string expression that evaluates to the name of the plugin. If a plugin by this name does not exist, the method returns undefined.

Example

The JSDO provides a built-in "JFP" plugin with a requestMapping function that supports the JSON Filter Pattern (JFP). The following example dynamically modifies this built-in plugin to handle the response from a particular OpenEdge Data Object resource, as follows:
jsdo = new progress.data.jsdo( . . . );

var defaultPlugin = progress.data.PluginManager.getPlugin("JFP");
defaultPlugin.responseMapping =

function ( jsdo, response, info ) {


var newData = response.dsCustomer.eCustomer;

for (var i = 0; i < newData.length; i++) {
newData[i].Country = "USA";
}

return response;

};
First, the getPlugin( ) method returns a reference to this built-in plugin as defaultPlugin. A custom responseMapping function is then dynamically registered for the plugin that modifies data in the dsCustomer.eCustomer table returned from the OpenEdge Data Object resource.
Upon execution, the fill( ) method performs conversions using the plugin's default requestMapping function, then invokes the resource Read operation on the server. When the response from the server is returned, this customized responseMapping function executes to modify response data before it is loaded into JSDO memory.
Note: For the OpenEdge Read operation to make use of this built-in "JFP" plugin, the ABL method that implements the operation in the Business Entity (the Data Object source) must be annotated with a mappingType property set to "JFP". For more information on annotating this property, see the Notes in the description of the addPlugin( ) method.

See also

addPlugin( ) method, fill( ) method