This article demonstrates how to use the MDM Application Toolkit to create a simple CRUD Human Service. The building blocks for performing these kinds of operations in BPM are integration service nodes. The MDM Application Toolkit provides a range of these integration services. In this article, you use the MDM Create, MDM Update, MDM Get, and MDM Delete integration services. These are easy to use, simplified integration services that facilitate the rapid development of MDM enabled business processes. The MDM Application Toolkit also provides integration services for interacting with the hierarchical tree Coach View and for performing advanced physical operations against an MDM server. These integration services will be described in subsequent articles in this series.
Preparing to build the services
The MDM Application Toolkit provides the integration services. To use those integration services, data types are required for the input and output parameters. Some of these data types are part of the Application Toolkit, such as the MDM_Connection business object. An instance of this business object is required by each of the four integration services that are covered in this article because the MDM_Connection data type specifies which MDM server to perform operations against.
Additionally, business objects that represent the data model of the MDM server are required. The simplest way of creating these business objects is using the BPM feature that creates business objects from a WSDL file. To make this process easier, the MDM Workbench has a wizard to create and export an appropriate WSDL file from a virtual or physical MDM environment.
Building a Create Coach
Continuing from the previous article in the series, this article assumes that you have already imported the virtual data types and have created a simple search operation in the IBM Process Designer.
- To build the CRUD Coach, first create a new Human Service, and call it
- Drag a Coach on to the human service and call it
- Switch to the Variables tab and create two private variables.
- Call the first variable
connection, and set its type to be MDM_Connection. Select the Has Default check box. Copy in the connection details that you used for the Search and Results Process in the article in Part 1 of this series.
- Call the second variable
newPersonand set the type to PERSON.
Figure 1. Screen capture of variables needed for the Create Coach
- Call the first variable
- Switch to the Coaches tab and create a coach for two sets of attributes. The first set of attributes is for the LGLNAME business object and the other set is for the HOMEADDR business object.
I used a combination of BPMs Vertical Section and Horizontal Section layout controls to build the coach shown in Figure 2. To create all the attribute fields (textboxes, and so forth), expand newPerson under the Variables part of the Palette and drag the LGLNAME and HOMEADDR business objects onto the Coach.
Figure 2. Screen capture of the Create Coach
Now, you can initialize the newPerson object. You need to fill the srcCode attribute of the MEMHEAD so that the MDM operational server knows which data source to add the record to. You also need to initialize the parts of the PERSON object you will be using in the Coach.
- Switch to the Diagram view and select the Create Coach.
- In the Properties view, select the Pre & Post
tab. In the Pre-execution Assignments area, initialize the newPerson
variable with the following values:
tw.local.newPerson = new tw.object.PERSON(); tw.local.newPerson.MEMHEAD = new tw.object.MEMHEAD(); tw.local.newPerson.MEMHEAD.srccode = "MOD"; tw.local.newPerson.LGLNAME = new tw.object.MEMNAME(); tw.local.newPerson.HOMEADDR = new tw.object.MEMADDR();
- Drag a Nested Service from the Palette and call it
do createand set the Attached Nested Service to MDM Create. Under the Data Mapping tab, set Connection to the connection object and set inputObject to newPerson.
Figure 3. Screen capture of the diagram for the Create Coach.
At this point, you are almost ready to run the Create Coach. You just need to wire up the nodes. Connect the Start node to the create Coach. Connect the create Coach to the do create node. Then connect that to the End node.
If your server is set up correctly, running the process and entering data into the fields on the Coach should result in a person being created. The Create integration service does not return anything, it simply creates the person. If it fails, an error is thrown.
As you can see, this is very similar to the search process that you created in Part 1 of this series of articles. In fact, all the processes are very similar. The update and delete Coaches are almost identical to the Create Coach. The only differences are with the inputObject parameter. Both the Update and Delete Coaches require that certain fields are populated in the MEMHEAD part of the object. As long as the object has been loaded from the MDM operational server, all of the necessary fields will be populated.
Building a Get Coach
To load an object from the MDM operational server, you must perform a Get operation. Use the same human service as before, and create a new Coach:
- Name the Coach Menu and insert it between the Start node and the create Coach.
- On the Menu Coach, place two buttons. Label one button
Createand the other button
- Connect the Create button to our create Coach, and change the line coming from Start so that it now points to the Menu Coach.
- Because the Get operation returns data that you want to view, you need
to create two Coaches with a Nested Service in-between the Coaches.
Call the first Coach
get, the nested service
do get, and the final Coach
person. Your diagram should now look like Figure 4:
Figure 4. Screen capture of the updated diagram for Get
- After you create these nodes, switch to the Variables tab.
- Create two PERSON variables and one NameValuePair variable. One of the
PERSON objects is used to tell the server which record to return. The
other variable is the result of the Get operation. Call the first
personToGet, the other variable
result, and the NameValuePair object
params. The NameValuePair object holds parameters for the operation. Set the NameValuePair Is List to true.
Figure 5. Screen capture of variables needed for Get
- Switch to the Coaches view. The get Coach is used to populate the criteria for the Get operation. The person Coach is used to display the retrieved object.
- Select the get Coach and expand the Variables section of the Palette.
Find the personToGet object, expand it, and then expand the MEMHEAD
attribute. Drag the ENTRECNO attribute onto the Coach.
Figure 6. Screen capture of the coach used to provide input to the Get operation
- Switch to the person coach. From the result object, drag a couple of
attributes onto this Coach. In Figure 7, you can see the MEMHEAD,
LGLNAME, and HOMEADDR attributes:
Figure 7. Screen capture of the Coach used to display results of the Get operation
- Return to the Diagram view. Click the do get service and in the Properties tab, set the Attached Nested Service to the MDM Get integration service.
- On the Data Mapping tab, set the following mappings:
- The Connection to the connection object
- The inputObject to the personToGet object
- The Parameters to the params object
- Under Output Mapping set the result to the result object.
- On the Pre & Post tab under Pre-execution assignments, specify the
following values to configure the parameters object:
tw.local.params = new tw.object.listOf.NameValuePair(); tw.local.params = new tw.object.NameValuePair(); tw.local.params.name = "entType"; tw.local.params.value = "id"; tw.local.params = new tw.object.NameValuePair(); tw.local.params.name = "memType"; tw.local.params.value = "PERSON";
The params object is used to tell the MDM operational server what entity and member types we are trying to interact with. These types are defined in the virtual MDM configuration.
You now need to connect the nodes in the Diagram. Connect the Menu Coach to the get Coach. Connect the get Coach to the do get service. Connect the do get service to the person Coach. Finally connect the person Coach to the End node.
In order to return an object, you will need to know its MEMRECNO value. To find the MEMRECNO, you can either run the Inspector application or use the Search integration service from the previous article.
Building an Update Coach
The Update and Delete operations are quite similar, and you will add them onto your existing service:
- On the Coaches view, select the person Coach.
- Drag a button onto the bottom of this Coach and change its label to
- On the Diagram view, drag a Nested Service near to the person Coach
and call the nested service
- Configure the do update nested service to run the MDM Update integration service. Under Data Mappings, set the Connection to be the connection object. Set the inputObject to the result object.
Figure 8. Screen capture of the diagram with the Update node
By using the result object, if a user makes changes to the data on the person Coach, the changes can then be sent back to the operational server simply by clicking the Update button. It would also be easy to use BPM to send the changes for a review before the changes are submitted back to the MDM operational server.
To complete the Update, connect the person Coach to the do update nested service, and the service node to the End node.
To confirm that the integration service works, you need to run the process twice and check that your changes are being retrieved from the operational server the second time.
Building a Delete Coach
To create the Delete service, the steps are similar to the steps that you used to build the Update Coach:
- Create a new button for the Delete service in the person Coach.
- Drag a nested service onto the diagram.
- Configure the nested service to use the MDM Delete integration service.
- Set up the Data Mappings using the same setting that you used for the Update service.
- Connect up the diagram the same way that you did for the Update service.
Figure 9. Screen capture of the diagram with Delete
You have now experienced just how easy it is to create CRUD operations for MDM-centric business processes using IBM Process Designer and the Application Toolkit. While this is clearly a simplified demo, with your MDM business objects represented in Process Designer, you can use the great features to create visually stunning coaches and complex workflows. These simple-to-use integration services enable decision making within MDM's rich workflow engine, powered by IBM BPM, to be based on high quality master data. In addition, you can use the integration services to create MDM-centric applications quickly and easily with minimal code.
- The MDM 11.0 Application Toolkit Information Center provides technical documentation for the features described in this article.
- The BPM 8.0.1 Information Center provides further information on working with BPM and Process Center.
- Get involved in the MDM Server developerWorks community forum.
Dig deeper into Information management on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Keep up with the best and latest technical info to help you tackle your development challenges.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.