Chapter 7. Sales order management in InterChange Server 235
Figure 7-33 shows the Map Designer after all of the mapping has been done.
Save and compile the submap.
Figure 7-33 Map the attributes
Order_to_JDBC_ORDERS
This map maps the information contained in the generic object Order to the
application-specific object JDBC_ORDERS. This map uses the submap
Sub_OrderLineItem_to_JDBC_ITEMS that we created before.
To create the map, use the following:
Source business object Order
Destination business object JDBC_ORDERS
Map name Order_to_JDBC_ORDERS
Mapping direction Generic to Application-Specific
The maps can be seen in Table 7-6.
Table 7-6 Mapping in CWOrder_to_JDBC_ORDERS
Source Destination
Verb Verb
OrderNumber ORDERNUMBER
CustomerId CUSTOMERID
236 Implementing and Administering WebSphere Business Integration Server V4.2.2
The STATUS field in the destination business object has a particular behavior
depending on the verb of the business object. If the verb is Create, then the
STATUS field will contain the OPEN value, but if the verb is Update, then it will
contain CLOSE.
To create this behavior, we create a custom rule:
1. Specify Custom as the rule for the STATUS attribute. The custom rule can be
created by entering Java code or via a graphical interface. To enter the Java
code, right-click in the rule and select View Source.
2. This opens a new window (Figure 7-34). Enter the code for a custom rule in
this window. To enter the Java code, select Tools Edit code and enter the
code, as shown in Figure 7-34.
Figure 7-34 Using Java code for a map
3. After the Java code is entered, save it. A warning message is shown,
indicating that we are overwriting automatically generated code and asking
whether to continue the process. Click Yes to continue.
OrderLineItem ITEMS
Source Destination
Chapter 7. Sales order management in InterChange Server 237
4. Figure 7-35 shows the Map Designer after all of the mapping has been done.
Save and compile the map. Note the different color for the rule Custom for
attribute STATUS. This is an indication that custom code has been written for
this mapping.
Figure 7-35 Mapping the attributes
238 Implementing and Administering WebSphere Business Integration Server V4.2.2
Before we move on to test this map, we look at how to use the graphical interface
to create custom rules.
1. The graphical editor is opened by double-clicking a custom rule.
Figure 7-36 shows the GUI interface with graphics that create the custom
rule. We can see the string comparison, as in the Java code. Assigning the
correct values to the STATUS must be done in the Condition node.
2. To assign values depending on the string comparison, double-click the
Condition node in Figure 7-36.
Figure 7-36 Creating a custom rule
Chapter 7. Sales order management in InterChange Server 239
3. Now we assign the true condition and the false condition (Figure 7-37).
Figure 7-37 Assign OPEN value to the STATUS field
The False Action schema is similar to Figure 7-37, but with CLOSE as the
constant value.
Testing the map
The final task before finishing a map is to test the maps. To test the map, click the
corresponding tab in the Map Designer.
We can use the resulting business object from our previous map testing as our
source destination data. To use the file we saved, select the source business
object, click Load From to browse for the file, and select OK. Now we have our
input data.
Select SERVICE_CALL_REQUEST as the Calling Context in the Source Testing
Data pane, and test the map.

Get Implementing and Administering WebSphere Business Integration Server V4.2.2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.