Introduction:
The relationship service has two distinct relationship types: static and dynamic. Static relationships are used to map between non-primary key values, where the data does not change frequently (such as zip codes). Dynamic relationships are used to define correlations on the key attributes that uniquely identify the business objects.
There are two enterprise systems, each with its own representation of data that needs to be associated through the relationship service.
Creating Relationship : Static (Which data need not change frequently)
Create the relationship
The relationship service has two distinct relationship types: static and dynamic. Static relationships are used to map between non-primary key values, where the data does not change frequently (such as zip codes). Dynamic relationships are used to define correlations on the key attributes that uniquely identify the business objects.
There are two enterprise systems, each with its own representation of data that needs to be associated through the relationship service.
Creating Relationship : Static (Which data need not change frequently)
- Start WebSphere Integration Developer (hereafter called Integration Developer) and create a new workspace.
- Choose File > New Mediation Module.
- Name the module
RelationshipService.
Create BusinessObjects.
Create Interfaces.
Define Mediation Module and Create BO map.
Create relationship, enter static data and reference it into BO map.
Test the Module.
Creating BusinessObject :
- In Integration Developer Project, select DataTypes > New > Business Object.
- Enter the details for the Namespace and the Name as shown in Figure1.
- Click Finish.
- The Business Object editor opens. For the WPSCustomer Business Object, add three string fields called:
lName
id
- The Business Object editor opens. For the WPSDetailCustomer Business Object, add three string fields called:
LastName
DeptNumber
Create the interfaces
- Return to the assembly diagram.
- Click the RelationshipService mediation and click Add interface.
- In the “Add interface” dialog box, select New.
- In the “New interface” dialog box, enter name of
WPSEvent
as shown in Figure2. - Click Finish.
- The Interface editor opens. Click the Add One Way Operation icon.
- Set the operation name as incomingMessage, the input name as customerIn, and the type as WPSCustomer.
- Select File > Save.
Figure 3:
- In the “New interface” dialog box, enter name of
WPSDetailEvent
as shown in Figure2. - Click Finish.
- The Interface editor opens. Click the Add One Way Operation icon.
- Set the operation name as receiveMessage, the input name as customerOut, and the type as WPSDetailCustomer.
- Select File > Save.
- Return to the assembly diagram and double-click on RelationshipService.
- A message displays indicating that the selected component is not implemented. Click Yes.
- In the “Generate Implementation” dialog box, click OK.
- The Operations Overview is now displayed. And input incomingMessage : WPSEvent is appeared.
- From the primitives pallet, select Transformations > Business Object Map and drag the primitive onto the flow.
- Wire up the Business Object map terminals to the input and callout terminals as shown in Figure 4.
- In the “New Business Object Map” dialog add map name as "MD_WPSCustomer_To_WPSDetailCustomer"
- Click Finish.
Figure 5:
- Click the + symbols to expand out both business objects.
- Drag a connection from the Name field on the left business object to the fName field on the right business object. Repeat this for the lName field.
- Perform this one more time for the town field. Once completed, click on the Move operation currently showing as the operation between the town fields (as shown in Figure 6). A dialog window is displayed with the various transformation operations available. From the list, select Relationship Lookup.
- Click the Relationship Lookup transformation and select Show in Properties.
- In the Properties tab, select Details.
- For the Relationship lookup definition, click New.
Create the relationship
- In the “New Relationship Dialog” box, CustomerDetail
- Click Next. Select Static Relationship and click Next.
- Select Identity relationship and click Finish.
- The relationship editor now opens. Click the icon for Add Role.
- In the dialog box, select WPSCustomer and click OK.
- Repeat this for the WPSDetailCustomer.
- Select the WPSCustomer and click the Add Key Attribute icon.
- In the “Select Key Attributes” dialog, select id and click OK.
- Repeat this for the WPSDetailCustomer.
- Next, click the CustomerDetail relationship icon (located just above the Add Role icon), and select the Show in properties view.
- In the Properties view, select the Instance Data tab (Figure 7).
- You can now populate the relationship with the data that the service will use to map the data.
Figure 7:
Test Module:- Return to the Assembly diagram.
- Deploy module into Server.
- Click the mediation and select Test Component.