Modeling your business processes with IBM WebSphere Lombardi Edition, Part 2: Using BPD and the integration, human and rule services

Part 1 of this series gave you an overview of the features and architecture of WebSphere Lombardi V7.1. In Part 2, you'll learn how to use the most common features of WebSphere Lombardi V7.1, including business process definition (BPD), and integration, human and rule services, to model the sample process.

Share:

Shuang Liang, Software Engineer, IBM

Shuang Liang photoShuang Liang was formerly a software engineer on the Business Performance and Service Optimization team in IBM Software Group. During his work in IBM, he focused on SOA and BPM technology and solutions.



Xi Ning Wang, Staff Software Engineer and Development Lead, IBM

Xi Ning Wang photoXi Ning Wang is a staff software engineer on the Business Performance and Service Optimization team in IBM Software Group, where he develops SOA and BPM technologies and solutions. He was designated an IBM developerWorks Contributing Author in 2009.



22 June 2011

Also available in Chinese

Overview

Part 2 describes how to use the most common features of WebSphere Lombardi V7.1 (hereafter called Lombardi) to model the sample process. We'll walk through the basic modeling of the business scenario process including the following features:

  • Process modeling using business process definition (BPD)
  • Integration service
  • Human service
  • Rule service

In the sample process, the buyer submits a purchase order using the web-based user interface (web UI), and then the customer relationship management (CRM) system automatically sends a notification to the supplier. The suppliers can confirm the order using a web UI with the following options: accept the order without any change, accept the order with changes, or reject the order.

In the case of accepting the order, if the supplier raises the unit price of goods, the system needs to notify the buyer to reconfirm the updated order. The buyer has the following options:

  • If the buyer accepts the updated order, the system automatically generates the final purchase order.
  • If the buyer does not accept the update order, the system sends a notification to the supplier and the purchase order process is halted.

If the buyer does not confirm the order, the system automatically generates the formal purchase order.


Create the business process

A business process is a collection of activities designed to produce a specific output for a particular objective, involving both human and system interactions. The process can include not only general integration services, activities, gateways and rule services, but may also use timer, message, and exception events.

When you model a process, you are creating a reusable business process definition (BPD). A BPD enables you to define the process workflow for end users by creating logic inside a process and integrating with other applications and data sources.

You can follow the steps below to create the sample process application from scratch, or import the ready-to-use process application provided for download with this article.

To create the sample process application, complete the following steps:

  1. Click the Process Apps tab, then click Create New Process App and provide the Process App Name (for example, Purchase Order Process), Acronym (for example, POP. The acronymn must be unique within your Lombardi environment.), and an optional Description (for example, This presents an example of a process for handling a purchase order.).
  2. Open Designer and select Create Business Process Definition (BPD).
  3. Click the Process App tab and select the Purchase Order Process in the Process App list to open the process in Designer.
  4. In Designer, select Processes => Create New => Business Process Definition.
  5. Create a BPD with the name Purchase Order Process.
  6. Next you need to create lanes. BPDs must include a lane for each system or group of users that participate in a process. A lane is the container for all the activities to be performed by a specific system or group of users.

    You add lanes to your process diagram to hold the activities and events that take place during process execution. When a new BPD is created, it contains two lanes by default. Drag the right side of the lane icon in the detail panel to the existing lane to create two new lanes. You can specify an optional name and color for each lane by selecting the lane, and specifying the name and presentation color in the properties section.

    In our example, there are four lanes in the main process: Buyer, Supplier, CRM and ERP.

  7. Now you need to create participant groups. These groups typically represent the user groups or departments in a business organization. In the Designer view, click the plus sign (+) next to Processes, then select Participant Group and enter the participant group name.

    In our example, there are four participant groups: Buyer, Supplier, CRM and ERP.

  8. Next, you'll create activities and a decision gateway. To do this, drag the Activity element in the right palette into one of the appropriate lanes of the process diagram to create the activities. Then drag the Decision Gateway element into the diagram, and specify Accept Order? as its name. If the status of the order is specified as Accepted by supplier, the decision gateway will go to the Need Buyer's Reconfirm? activity; otherwise, it will go to Send Reject Notification to Buyer activity.
  9. Using the same process, create two more decision gateways: Need Confirm? (by using the needBuyerConfirm variable to describe its value), and Buyer Accept? (by using the status of the order to describe its value). If the status of the order is specified as Accepted by buyer, the decision gateway will go to the Generate Order activity; otherwise, it will go to the Send Reject Notification to Supplier activity.
  10. For each BPD that you create, you need to declare variables to capture the business data that is passed from step to step in your process. To do this, on the Variables tab, click Add private to add a private variable called Order with a type of Order, and a private variable called needReconfirm with a type of Boolean.

You have now created the sample process application. The resulting business process is shown in Figure 1.

Figure 1. Purchase order process
Purchase order process

(See a larger version of Figure 1.)


Create integration services

An integration service is usually used when you want to integrate with an external system to complete a task. For example, you can build an integration service that calls a web service to perform some business logic. Integration services are the only services that can include web service integration and Java™ Integration components.

Create a web service integration

In our example, we use one Web service integration to implement the notification function that is invoked in the process. To create this service, do the following:

  1. Select Implementation => Integration Service and create an integration service called SendNotification.
  2. In the diagram of the new SendNotification integration service, drag Web Service Integration from the right palette and rename it Send Notification by Email, then use the sequence flow to link it with the start and the end of the integration service diagram.
  3. To discover the web service, on the Implementation tab of the property view, specify the WSDL URI of the web service and click Discover, as shown in Figure 2.

    You can get the WSDL and XSD files from the Downloads section of this article and develop your customized web services based on these WSDL and XSD files. Then you can deploy these web services on your application server,

    Figure 2. Discover the web service
    Discover the web service
  4. Click Generate Types, then accept the default options to generate variable types. This generates variable types as shown in Figure 3.
    Figure 3. Generated variable types provided by web service
    Generated variable types provided by web service
  5. Select the Send Notification by Email web service integration and, in the property view, select Notify Supplier from the discovered operation list.
  6. On the Variable tab, click Add Input to create an input variable. Specify the name of the variable as inputOrder and change the Variable Type to Order.
  7. Repeat the previous step to create an output variable called outputResult with a type of String.
  8. In the Data Mapping property of the SendNotification integration service, map the inputOrder to order and outputResult to result.

Create Java integration

In our example, we use the Java integration component to integrate the external Java class in order to implement the price calculation and payment function that is invoked in the process.

  1. Before creating the integration service, add the JAR file that contains the classes by clicking the plus sign (+) next to Files in the library in the Designer view and select Server File. In the New File dialog, click Browse and select the payment.jar file provided in the Downloads section.
  2. Create an integration service, then drag a Java integration component from the palette to the service diagram and use sequence lines to connect the component to the Start and End events.
  3. Click the Java integration component in the diagram, then click Definition in the properties. Click Select beside Java Class and choose the JAR file and the class, as shown in Figure 4.
    Figure 4. Java integration
    Java integration

Create a human service

A human service is the only type of service that can contain coaches and user interaction. Build a human service when you want a step in your BPD to create an interactive task that process participants can perform in a web UI. When you build human services, you include coaches, which are the web-based forms that provide process-related data to end users, as well as collect input from those users. Coaches enable you to easily add standard fields and controls, such as radio buttons, drop-down menus, and so on.

Create a human service called Submit Purchase Order by following the steps below:

  1. Open the Purchase Order Process BPD, right-click the Submit Purchase Order activity and select Activity Wizard from the list of options.
  2. In the Set Up Activity dialog, specify Human Service (Service with human interaction) as the service type and create a new service called Submit Purchase Order, then click Next.
  3. In the Parameters dialog, select the existing process variable order to use as input and output for the new service, then click Finish. The new service is created and automatically attached to the activity.
  4. The new service includes a single coach. Click the Coaches tab, then click the listed coach component to open the Coach Designer.
  5. Drag the orderHead and orderDetail variables into the coach form page, as shown in Figure 5.
    Figure 5. Coach for Submit Purchase Order
    Coach for Submit Purchase Order

    In general, coaches are highly customized to render a particular look and feel in a typical Lombardi deployment. For example, you may want to customize coaches to use corporate logos and colors. In many cases, you can meet your customization requirements by configuring the presentation and visibility properties available in the Designer interface. In Part 3 of this series, you'll learn about the advanced features of coaches.


Creae a rule service

Use a rule service when you want a condition to determine the execution path or make variable assignments based on potential values of other variables. For example, when a certain condition evaluates to true, the JavaScript expression that you provide as the action is executed. The action of a rule service cannot directly invoke Java or web service integrations. You can call a rule service from any other type of service, and a rule service can call other nested services.

In our scenario, if the supplier changes the quantity or price of goods, the rule service will validate the order change following the business rules below:

  • If the added quantity rate is less than or equal to 10%, and the updated price is not higher than the original price, then the buyer need not reconfirm.
  • If the added quantity rate is less than or equal to10%, but the updated price is higher than the original price, then the buyer needs to reconfirm.
  • Otherwise, if the added quantity rate is greater than 10%, then the buyer also needs to reconfirm.

Because there are multiple order items within one order, the rule service must be executed repeatedly. To accomplish this, select the Need Buyer's Reconfirm? activity, and click Step in the properties. Then select the Simple Loop option from the Loop Type drop-down list under Behavior. Then under Simple Looping, specify the length of the order items as the loop maximum value as shown in Figure 6.

Figure 6. Simple loop
Simple loop

Create the rule service called Need Buyer's Reconfirm? by completing the following steps:

  1. Open the Purchase Order Process BPD, right-click the Need Buyer's Reconfirm? activity and select Activity Wizard.
  1. In the Set Up dialog of the Activity Wizard, specify Rule Service (Rule based service without human interaction) as the service type and create a new service called NeedReconfirm?, then click Next.
  2. In the Parameters dialog, specify the existing process variable needReconfirm as output for this new service, then click Finish. The new rule service is created and automatically attached to the activity.
  3. Create an input variable with the name of orderDetail and a variable type of OrderDetail. Then create two private variables called updatedQuantityPercent and updatedUnitPricePercent using the same decimal type.
  4. Add one service script activity before the rule script activity, and implement this activity using the JavaScript expression as shown in Listing 1.
Listing 1. Initialization for rule service
if(tw.local.orderDetail.quantity == 0 ){
  tw.local.updatedQuantityPercent = 1;
}else{
  tw.local.updatedQuantityPercent = (tw.local.orderDetail.updatedQuantity -
tw.local.orderDetail.quantity)*1.00/tw.local.orderDetail.quantity;
}

if(tw.local.orderDetail.unitPrice == 0 ){
  tw.local.updatedUnitPricePercent = 1;
}else{
  tw.local.updatedUnitPricePercent = (tw.local.orderDetail.updatedUnitPrice -
tw.local.orderDetail.unitPrice)*1.00/tw.local.orderDetail.unitPrice;
}
  1. Double-click the rule script to open it for editing. Click the Rule tab, and click the Add a variable (column) to the rule icon (the green plus sign in the upper left) to add the variables updatedQuantityPercent and updatedUnitPricePercent.
  2. Specify the value for each cell according to the business rule described in the previous section. The result should look like Figure 7.
    Figure 7. Rule script
    Rule script
  3. Finally, you need to specify the input mapping between the Need Buyer's Reconfirm? activity and the rule service. In this example, the value for the input is: tw.local.order.orderDetail[tw.system.step.counter].

Test the process

The Lombardi Authoring Environment Inspector is key to an iterative approach to process development. Using the Inspector, developers can run processes and services on the Process Center server or remote runtime process servers. An entire development team can use Inspector to run and test the process.

To run a process and then manage running and completed instances of that process in the Inspector, do the following:

  1. Open the Purchase Order Process and click the Run Process icon in the upper right. When prompted whether you want to change to the Inspector interface, click Yes.
  2. In the Process Instances tab, you can see all currently active and completed process instances. To control instances, select an instance from the list and then click the toolbar option that you want. For example, to stop an instance that you started earlier, click the instance, then click the icon to terminate the instance.
  3. Click the new or received task, then click the Run task icon in the upper right, as shown in Figure 8. In some cases, you may need to select a user account and password in order to run a task. This is controlled by lane assignments and routing for activities.
    Figure 8. Run the Submit Purchase Order task
    Run the Submit Purchase Order task
  4. Select Task:Submit Purchase Order and click Runs the selected task. In the purchase order BPD, the coach for the Submit Purchase Order task opens in a browser as shown in Figure 9.
  5. Fill in the fields and click OK button. The BPD continues to the next step. The Inspector shows the progress by moving the token to the next step in both the BPD diagram and the tree view.
    Figure 9. Submit Purchase Order coach user interface
    ubmit Purchase Order Coach UI

Conclusion

This article showed you how to use some of the common features of WebSphere Lombardi Edition V7.1 to model a business process. These common features included BPD, integration services, human services, and rule services. In Part 3, you'll learn how to use the advanced features of WebSphere Lombardi Edition V7.1 to enrich the sample process to address more complex requirements and user interaction.


Downloads

DescriptionNameSize
Purchase Order Process filePurchaseOrderProcess_v6.zip416KB
WSDLsWSDLs.zip3KB
Payment JAR filepayment.jar2KB

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Business process management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere
ArticleID=681413
ArticleTitle=Modeling your business processes with IBM WebSphere Lombardi Edition, Part 2: Using BPD and the integration, human and rule services
publish-date=06222011