Part 1 of this series gave you an overview of the features and architecture of WebSphere Lombardi V7.1 (hereafter called Lombardi). In Part 2 you learned how to use the most common features of Lombardi, including business process definition (BPD), and integration, human and rule services, to model the sample process. In Part 3 you learned how to use some advanced features of Lombardi to enrich to meet more complex requirements, including nested processes, milestones, event mechanisms, exception handling and Lombardi web services exposure.
In Part 4, you'll learn about using Lombardi Coaches to build human services. We'll continue to use the typical business scenario of a purchase order process as our sample.
Overview of the Lombardi Coach designer
Lombardi Coaches provide the interface for end user interaction, and are usually used to build human services. Figure 1 shows the layout of the Lombardi Coach designer.
Figure 1. The Coach designer
- Shows all the Coaches in the currently opened service. You can change or implement the Coach page by clicking one of the Coaches.
- Shows the design and implementation of the selected Coach in the Design tab. You can click the Preview tab to see how the Coach will look to end users when the service runs.
- Use the first three icons to: (1) show the design of the Coach; (2) show both the design and the code of the Coach; (3) show only the code of the Coach, respectively;
- Lists the sections, controls, and variables that you can include in the Coach. Drag a section or control from the palette to the Design tab to add it to the Coach. To create a control for a variable included in the service, drag a variable from the palette to the Design tab. The type of control created depends upon the variable. For example, an input variable that is a String creates an Input Text field.
- Shows the properties for the control selected in the Design tab. Figure 1 shows the properties of Order Name in the Order Head Coach.
In this article, we'll build a Submit Purchase Order human service in the
sample Purchase Order process using Coaches. For the sample Purchase Order
process, the buyer needs to submit a purchase order to start the process.
The Submit Purchase Order human service we'll build needs to gather the
buyer's input as the value for the complex variable
Figure 2 illustrates the data structure of the complex structure
variable is one instance of
Order, and includes
two complex variables:
orderDetail. In addition,
orderDetail is a list, or array, of the complex
OrderDetail. Therefore, an
order will include one
orderHead and one or more
The Submit Purchase Order human service will provide a user interface user
interface to gather user information to populate the variable
Figure 2. The data structure of Order
Figure 3 illustrates the overall Coach design for the Submit Purchase Order
human service. First, you need to initiate the complex variable
tw.local.order. Since one
tw.local.order has one
tw.object.OrderHead and one or more
tw.object.OrderDetail, we'll build separate
Coaches for Order Head and Order Detail. Finally, we'll build a coach show
the order summary to the user.
Figure 3. The overall coach for Submit Purchase Order
Initiating the Output Server Script
Order is a complex variable, you first
need to initialize it. Figure 4 illustrates the implementation of the
initialization. You can use
tw.object.objectType to initialize the
variable with type
objectType, and use
new tw.object.listof.objectType to
initiate a list variable with a type
objectType. Use a
Script element to do the
Some of the properties of
Order can be assigned
default values; for example, the identifier of
orderHead can be initialized as the process
tw.system.currentProcessInstanceID) and the
order date and time can be initialized as the current system date and
time, as shown in Figure 4.
Figure 4. Initiating the output server script
Creating the Order Head Coach
As you saw in Figure 4, an order will include one
orderHead and one or more
orderDetail variables. To fulfill the
order variable, you need to provide an
interface to gather
orderDetail information. Since there is only
orderHead for an order, you first need to
create a Coach for
Figure 5. The Create Order Head Coach
Figure 5 illustrates the implementation of the Create Order Head coach.
orderTime are initiated as shown in Figure 4,
orderCloseTime will be assigned values at the
close of the order, you only need to build inputs for
String type input, drag and drop Text
or Text Area (for multiple line input) from the palette on the
right, then change the Label and select Binding for the
input text, as shown in Figure 6.
Boolean type input
needBuyerConfirm), you can drag and drop
Check Box from the palette, then configure the Label and
Binding properties, as you did with the input text.
Figure 6. Configure Input Text properties
After gathering the user input, you need at least one button to submit the form values to the back-end. Figure 7 shows the properties of the Button Group. In the Presentation properties, you can configure the Label and even add some scripts under Validation Script to do some validation.
Figure 7. Configure Button Group properties
Creating the Order Detail Coach
The Create Order Detail Coach is more complicated than the Create Order
Head Coach, because there is uncertain number of
orderDetail variables, or the
orderDetail may be a list. Because the number
orderDetail instances in an order is
determined by the user, you can build the Coach with one page and can loop
back to the page. Figures 8 and 9 illustrate the variables and
implementation of the Create Order Detail Coach.
Figure 8. The variables of Create Order Detail Coach
Figure 9. The implementation of the Create Order Detail Coach
You can define two private variables:
orderDetailNum (Integer) to record the current
OrderDetail user inputs; and
record the value of
OrderDetail user inputs in
the Coach page.
In the Order Detail Coach page, we'll build the following four properties
unitprice. Other properties will either be
automatically generated or defined at at later stage. The four properties
have three text inputs, which can be configured as shown in Figure 6.
productNumber is a Single Select control.
Figure 10 shows the presentation properties of a Single Select. Data for a
single select control can be either manual or dynamic. Manual data
has two columns: Value is the real value when submitting the form
to the back-end, Display Text is the text displayed on the page. In
this example, we'll build the
select using manual data. You'll learn how to use dynamic data in Part
Two buttons in the Create Order Detail Coach page control the logic. When
either button is clicked, the value of
orderDetailTmp is added to the
tw.local.order.orderDetail list. If the Save
& Create Another Order Detail button is clicked, the user is
redirected to the Create Order Detail Coach page. If the Next
button is clicked, the Create Order Detail step is finished.
Figure 10. Single Select properties
Figure 11 shows the implementation of the logic. In the beginning,
orderDetailNum has a default value of zero, and
tw.local.orderDetailTmp is instanced as a new
Figure 11. The pre- and post assignments for Create Order Detail
After the user submits the Coach page,
tw.local.orderDetailTmp is added to the
tw.local.order.orderDetail list, as shown in
Listing 1. Post-execution assignments
tw.local.order.orderDetail[tw.local.orderDetailNum] = new tw.object.OrderDetail(); tw.local.order.orderDetail[tw.local.orderDetailNum].shipDate = tw.local.orderDetailTmp.shipDate; tw.local.order.orderDetail[tw.local.orderDetailNum].productNumber = tw.local.orderDetailTmp.productNumber; tw.local.order.orderDetail[tw.local.orderDetailNum].quantity = tw.local.orderDetailTmp.quantity; tw.local.order.orderDetail[tw.local.orderDetailNum].unitPrice = tw.local.orderDetailTmp.unitPrice; tw.local.order.orderDetail[tw.local.orderDetailNum].orderDetailCode = tw.system.currentProcessInstanceID + tw.local.orderDetailTmp.productNumber; tw.local.order.orderDetail[tw.local.orderDetailNum].orderNumber = "ORDER_" + tw.system.currentProcessInstanceID + tw.local.orderDetailTmp.productNumber; tw.local.order.orderDetail[tw.local.orderDetailNum].updatedQuantity = tw.local.orderDetailTmp.quantity; tw.local.order.orderDetail[tw.local.orderDetailNum].updatedUnitPrice = tw.local.orderDetailTmp.unitPrice; tw.local.orderDetailNum = tw.local.orderDetailNum + 1;
Creating the View Order Summary Coach
After the Create Order Head and Create Order Detail Coaches are completed, the order is fulfilled and job of the Submit Purchase Order Human Service is finished. However, it's a good idea to show a summary of the order to the user. Figure 12 illustrates the implementation of a View Order Summary Coach.
The Order Head section shows the value of
tw.local.order.orderHead as output text. The
Order Detail section shows the value of
tw.local.order.orderDetail as a table control.
The table control displays the
is needed only to configure the Binding property, similar to the Text
Figure 12. The View Order Summary Coach implementation
Running the Coaches
Figures 13, 14 and 15 illustrate the completed Submit Purchase Order human service. When the user enters the values for Order Head and clicks Next, the Create Order Detail page is displayed. The user can create any number of order details by clicking the Save & Create Another Order Detail button. Finally, the user is shown a summary of the order.
Figure 13. Submit Purchase Order Coach
Figure 14. Order details
Figure 15. Order summary
In this paper, you learned how to use Lombardi Coaches to build human services. The Coach capabilities enrich the user experience in our sample purchase order process.
In Part 5, we'll cover more advanced Coach features, including dynamic data binding, the runtime rendering mechanism of the Coach, and how to customize the Coach.
- IBM WebSphere Lombardi Edition 7.1.0 Information Center
- WebSphere Lombardi edition
- Business Process Modeling Notation (BPMN) web site
- Introduction to BPMN (PDF)
- BPMN and Business Process Management
- developerWorks BPM zone
- IBM BPM Journal