A custom method is used to call a function from a custom Java class in a package. It is declared and used globally for all target elements.
To use a custom method in a mapping activity, you need to map it to a target element. This will successfully execute the custom method when you execute the mapping activity in the process flow.
Prerequisites
Click the Custom Methods tab.
Enter the number of arguments taken by Method in the #Parameter column. A custom method can take any number of arguments. However, if you enter a value greater than 4, then a warning message appears.
To remove a custom method, select the custom method and click the Remove selected method () button. Alternately, you can edit or delete a custom method from the Parameters Panel itself. For details, refer to the Managing a Global Variable from Parameter Panel section. |
Map Custom Method to Target Element
Once you have created a custom method, you can map it to a target element. To map:
Double-click the required custom method under Custom Methods in the Parameters Panel. The selected method node is displayed in the Mapping Graph Area.
If the custom method is defined with more than 4 parameters, then double-clicking the custom method will display the warning message. Once you click OK, you need to define the mapping using Textual Rules.
Create a link from the output of the custom method node to the input of the target element.
Save the mapping activity and exit the Data Mapper.
You can view and validate the generated mapping XSL, view the target XML and, view and validate mapping output, before saving the mapping activity.