Pre-requisite:
1. Awareness about the new Java mapping api for PI 7.1 - Refer this
2. To get the required libraries/api - Refer this
3. What is parametrized mapping? - Refer this
Parametrized Java Mapping
To start with, there is an excellent wiki from Abhinash Nanda which captures what has changed and what is 'new' in the latest api, followed by a sample code which should give the reader a good idea and grasp on the usage.
To explain in detail on how to parametrize a java mapping, lets take a simple requirement. In the target message, we need to remove a XML tag. We will be using a simple java mapping to achieve this. To make the java mapping dynamic, we will parametrize the same. (Thus we achieve reusability of the mapping)
Reference Java code - Link
The following is the code snippet that will provide access to the Parameter in the mapping;
String inParam = arg0.getInputParameters().getString("TAG_NAME");
getTrace().addInfo("Input Parameter: " + inParam);
What happens in the ESR?
So what is it that we need to do for enabling the parametrization in the ESR?
1. Add the java mapping to your operation mapping.
2. Open the Parameters Tab and create a parameter that will be used.
3. Provide the binding for the parameter. The 'Name' assigned here will be used to reference the parameter in the Java mapping.
Once the above is done, during configuration in the integration builder, you can provide the required binding i.e the actual value that needs to be passed into the mapping.
Testing Java Mapping as a standalone application
There are four classes written that will help in the standalone testing of the java mapping;
1.InputPayloadImpl
2. TransformationInputImpl
3. OutPayloadImpl
4. TransformationOutputImpl
Thanks to my colleague Chandra Singh, for helping me out with that piece of code.
In the main() method, these classes are used to instantiate an inputstream and outputstream object so that the input can be fed through a file and the output captured to a file for easy analysis and debugging of the data.
Additional Info:
If you have multiple mappings assigned in sequence in the operation mapping, using the test tool you can easily check the result of each flow.
Say we have two mappings assigned in the Operation mapping, Mapping1 and Mapping2. Using the test tool we can easily confirm the outputs of the entire flow or the separate flows.
Following are some screenshots;
End to End Mapping Test:
Testing Mapping1 only:
Testing Mapping 2 only:
To Test the Parameterized mapping in Operation mapping:
"
Hope this was informative 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |