Portlet Factory, Version 6.1.2


 

Transform builder input

This topic describes the Transform builder inputs.

Table 1. Transform builder input
Input Name Description
Name Enter a name for this builder call. IBM® WebSphere Portlet Factory Designer displays this name in the builder call list.

Note: The name you provide is used as the name of the Java class that is added to the WebApp and which supplies the invoke method that invoked to execute the copy/merge operation.

Source Variable Use the picker to select the variable that is to be operated upon.

All schema typed variables known in the WebApp are displayed.

Source XPath Select the deepest parent node that is to be copied. The selected node is the node that is to match up with the node chosen for the target XPath above.

For example:

To copy the dateOfBirth and SSN nodes in the following:

<a><b><c><DateOfBirth/><SSN/></c></b></a> to <w><x><y><z><dob/></z></y></x></w>

Specify a/b/c as the target XPath and w/x/y/z as the source XPath.

Clear Target Value First Enable to the empty target variable content before start of the copy/merge operation.

Note: Default behaviour is disabled (unchecked) This allows the copy/merge operation to merge data into the existing variable's content.

Target Variable Select the variable that is to be the target of the data being copied across.

All schema typed variables known in the WebApp are displayed

Target XPath Select the deepest parent node that is to be targeted.

For simple schema types this will simply be the name of the top-level element ("Imports") that has all the child elements beneath it that will be updated by the content from the source variable.

In more complex schema types, the target XPath might be:

response/output/rows/row

The source XPath will map an element such as "AppMessage/ListOfStuff/Asset" to it.

In this case, the children of "Asset" will be mapped across to the children of "row", and additional matching of the parent nodes will take place also.

Child-Node Mappings

Copy Non-Matching Source Nodes Enable to copy non-matching source nodes.

Disable to ignore non-matching source nodes.

Example:

<a><b><c><DateOfBirth/><SSN/></c></b></a> to <w><x><y><z><dob/></z></y></x></w>

In the above code, you could choose that DataOfBirth be mapped to dob.

If this check box is checked, the SSN node will also be copied across to be a child of <x>.

Doing this will produce XML not compliant with the schema of the target variable, but it is allowed since it can be a useful feature and you might have other transforms yet to be performed.

Clear all Child Mappings Press this button to clear the columns of the Child/Leaf Node Mapping.

Selecting the source or target XPaths will repopulate source node/target node columns respectively.

Child/Leaf Node Mapping Once you select the target and source XPaths, the builder will populate the Target Node and Source Node columns with the known children of those nodes. Use the pickers to selection nodes or change the position of entries in the table. Your selections will determine which source child elements map to which target child elements.

The pickers in the "target node" and "source node" columns are populated with the child element list to allow you to choose which source nodes map to which target nodes.

Target Node

Select a child element of the target node to which to map.

Source Node

Select a child element of the source node from which to map.

Custom Copy Action

Select an action. The custom copy action lists any WebApp methods that take two IXML arguments. When specified for a node, after the source node is copied across to the target that custom method will be invoked and the source node and target node will be passed as arguments. This allows you to do some custom modification of the target xml, such as converting text to lower case, concatenating a value from another XML node in the source/target tree, and so on.

Merge Duplicates

Enable to merge source elements with existing target child elements. When copying across a source child element, if a matching target child element already exists, this setting determines if the source element is merged, or copied across as a new "duplicate" instance in the target element.

Note: The source and target XPaths specify which parent source node is being mapped to which parent target node. This section is automatically populated with children from those two nodes and an attempt is made to match up the nodes based on their names.

Parent Node Mappings

Parent Node Mapping This section allows you to specify the mapping between the ancestor nodes in the parent lineage, and is especially useful (necessary) if the target and source have a different number of parent nodes. This mapping allows you to specify which mappings are kept or ignored.

The source and target XPaths specify which source node is being mapped to which target node. When the target and source XPaths are selected, the target/source columns are populated with the known ancestors of those nodes.

The table lists each ancestor node of the target and source nodes, allowing you to pick which node will maps to which. For each mapped pair, you can also specify additional matching parameters.

Target Node

Select a target parent node to which to map.

Source Node

Select a source parent node to map from.

Match Empty Text

The "match empty text" column influences node matching as follows: Normally a node <b> will be determined to "match" a node <x> (using our example from earlier) if the text of node <x> is the same as the text of node <b>. Selecting the "match empty text" column for a row designates that a node <x> with no text will be considered to match a node <b> with no text. Usually this behaviour is not needed, hence the default of not selected, but sometimes it is useful.

Remove Attributes

Enable the check box to suppresses the copying across of the attributes of a source parent node. When the parent node instances are being evaluated or copied across, default behavior is to copy across attributes from the source node to the target node, even if strictly speaking it is not conformant with the target schema. Removing attributes allows subsequent transforms to rename, remove or modify those attributes.

Match Nodes By

Specify how each parent source node should be compared to corresponding target parent node, to determine whether to merge the source node into the target node, or to create a new target node to copy the source node into. You can choose:

Parent Node Text

To compare text of source parent node to text of target parent node.

Child Node Text

To compare the text of the specified source parent node sub-element to the text of the specified target parent node sub-element.

Custom Method

To use a custom method, which takes two IXml elements, the source parent node and a target parent node, and return true if the nodes should be merged, and false otherwise.

Source to Match

Available enabled if Match Nodes by Child Node Text is specified. Select a sub-element of the Source Parent node. The text of the sub-element will be compared to the Target to Match sub-element text to determine whether or not to merge the specified source parent node into the target parent node.

Target to Match

Available if Match Nodes by Child Node Text is specified. Select a sub-element of the Target Parent node. The text of the sub-element will be compared to the Source to Match sub-element text to determine whether or not to merge the specified source parent node into the target parent node.

Custom Method

Available if Match Nodes by Custom Method is specified. Select a custom method which will be used to determine whether or not to merge a source parent node into a target parent node. Drop down will be populated will all methods in the WebApp that take two IXml argument and return boolean.

Parent topic: Transform builder


Library | Support |