Do you know how to modify graphically some of the elements in a complex element without having to map all of the elements? In IBM Integration Bus, the Graphical Data Mapping editor has the Override function that allows you to modify some of the elements while all the other elements stay unchanged. This post explains how to use the map override feature.

Overview

You can use the Override function to copy a complex type from the input to the output object, while updating some of the child elements in the complex type.

Note: Performance is not improved by using the Override function.The mapping engine still needs to copy over all the elements and set the new values for the ones you have to change.

The Override function is very convenient in multiple situations. For example, a use case is when the Local environment has to be updated. When you add a LocalEnvironment in the mapping node and you would like to keep values that have been already stored in it whilst modifying some of them, you have to add the input LocalEnvironment to the map and perform a Move from the input to the output. Then, define transform to set some of its elements and group them within an Override.

Talking of performance brings another point to mind, Override is no more efficient execution .. it does get expanded at runtime to moves of every leaf element. I think we should include that please

Example

This example explains how to use the map override feature to set new values for some elements in the output Local Environment tree:

Step 1: Connect the input element to the output element with a Move transform. This ensures that the data is available downstream the flow.

In this example, the input LocalEnvironment tree is mapped by a Move transform to the output LocalEnvironment tree.

Step 2: Define a transform to set the value of an element in the output structure.

You can include Move transforms and Assign transforms within an Override.

In this example, I want to copy the value of the input element LocalEnvironment.File.Name to the output element LocalEnvironment.MQ.destinationData.queueName. To set the value, I define a Move transform between these two elements.

Alternatively, I could have used the Assign transform to set the value of LocalEnvironment.MQ.destinationData.queueName to a constant or fixed value.

Whether I set the value by using a Move transform or an Assign transform, the transform displays an error and a light icon. The light icon provides a quick fix with choices to resolve the error.

Step 3:  Form the quick fix options, select Group the conflicting transforms in an override group.

You can see that the Graphical Data Mapping editor adds an Overrides group where the two transforms are included ( the main transform and the newly created).

This shows the result:

Join The Discussion

Your email address will not be published. Required fields are marked *