Skip navigation.

Tutorial: Building a Worklist Application

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

Step 5. Receive Resolution Approval From the Task Owner

In the preceding step, you designed the logic in the business process that assigns the task of approving the resolution of a bug to the user who created the bug. The design only allowed that the task owner could approve the resolution of the bug in two days. This step describes how you design your business process to handle other possible events.

The business logic in the tutorial scenario dictates that the business process handle the receipt of one of multiple possible events from the Task control. When you design business processes in WebLogic Workshop, you can use an Event Choice group to create logic that causes the process to wait to receive one of a number of events. In this step, you learn how to design an Event Choice group for this scenario.

It includes the following tasks:

 


Create an Event Choice Group to Handle the Resolution Approval Events

When you design business processes in WebLogic Workshop, you can use an Event Choice group to create logic that causes the process to wait to receive one of a number of events. After it receives one of the possible events, the flow of the business process continues. You design additional nodes within an Event Choice group to handle the incoming events. The flow of execution proceeds along one branch in an Event Choice node; the branch containing the event that happens first.

To Create an Event Choice Group

  1. Ensure that the Resolution Approval business process is displayed in the Design View.
  2. Note: To add logic to the business processes that you design in WebLogic Workshop, you drag the process node that represents that logic from the Palette onto the process in the Design View.

    If the Palette is not visible in WebLogic Workshop, choose View—>Windows—>Palette from the WebLogic Workshop menu.

  3. Click Event Choice in the Palette, then drag and drop it onto the Resolution Approval business process, placing it immediately after the createAndAssignTask (Alternatives 1, 3) or setCompletionDueBusinessDate (Alternative 2) node.
  4. The business process is updated (in Design View) to contain a representation of the Event Choice group as shown in the following figure:


     

    Note that by default, Event Choice nodes are created with two branches. In this step, you design the Resolution Approval business process to handle a business scenario in which the task control returns one of three events. Therefore, you must expand the default Event Choice group to include a third Message Event branch, as described in the next step.

  5. Click one of the on the Event Choice group. An additional Message Event branch is created. The Event Choice group should resemble the following:

  6.  

    The Event Choice node can now handle the receipt of one of three possible events from the Task control.

 


Specify the Events That the Business Process Can Receive From the Task Control

The first node on each branch of an Event Choice group handles the receipt of one event. At run time, the flow of execution proceeds along one branch in an Event Choice group, specifically, the branch containing the event that happens first.

In the tutorial, you design the Message Event branches to handle the following events:

To design the Message Event branches, you specify a callback method on the Task control (taskCtrl) to create and bind to a Control Receive node at the beginning of each branch in the Event Choice group, as described in the following steps:

  1. If necessary, expand the list of methods available in the Controls tab of the Data Palette by clicking the + beside the taskCtrl control.
  2. Select the following method:
  3. void onTaskCompleted(XmlObject response)

    Then drag and drop it onto the Event Choice group, placing it on the left-most Message Event branch. By doing so, you specify a Control Receive as the Starting Event on the branch and bind the onTaskCompleted callback method to that Control Receive node. The Event Choice node is updated in the Design View to reflect the changes you made:


     
  4. Repeat the preceding step two more times, selecting in turn the following callback methods to drag and drop from the taskCtrl control in the Data Palette:
  5. After you complete this step, the Event Choice group in the Design View should resemble the following figure:


     

    You have now completed the specification of the possible events generated by the Task control.

 


Design How the Callback Events are Handled by the Resolution Approval Process

At run time, the Resolution Approval business process blocks waiting for an event from the Task control before it proceeds. The flow of execution proceeds along one branch of the Event Choice group—the branch started by the event that happens first.

To Design For the Scenario in Which the Bug Resolution is Approved

No further design is required for the onTaskCompleted or onTaskOverdue nodes. At run time, whenever either of these message events is received, the business process exits the Event Choice group and proceeds to the next node in the process. The next node, which you will design in this step, is a Client Response node, which sends an approval message to the client. This node is followed by the Finish node, which marks the end of the business process.

To create the Client Response node, complete the following steps:

  1. In the Palette, click Client Response, then drag and drop it onto the Request Approval business process, placing it on the process immediately after the Event Choice group and immediately before the Finish node.
  2. Rename the node from Client Response to Resolution Approved.
  3. Double-click the Resolution Approved node to open its node builder.
  4. On the General Settings tab, in the Method Name field, change the clientResponse to approved.
  5. Click the X in the top right-hand corner of the node builder. The node builder closes.
  6. No further specifications are required on the Resolution Approved node. The business logic in the tutorial scenario does not require that a document is sent to the client as the result of the bug resolution being approved.

To Design For the Scenario in Which the Bug Resolution is Appealed

However, because the SoftCo business scenario dictates that appeals must be accompanied by a document that describes the reason for the appeal, we want to design additional logic in the process for the case in which an onTaskAborted message event is received. This section describes how to design the onTaskAborted branch of the Event Choice group, which defines the flow of execution when the Task owner appeals the resolution of the bug. This section contains the following steps:

To Design the onTaskAborted Message Event Branch

  1. Double-click the onTaskAborted node to open its node builder. The node builder opens on the General Settings tab. The Control instance and target methods are already selected:
  1. Open the Receive Data tab.

  2.  
  3. Create a variable to which the document returned by the Task control, containing the reason for the appeal, is assigned at run time:
    1. Under Select variables to assign, click the arrow in the drop-down list and select Create new variable.... The Create Variable dialog box is displayed with XML selected as the variable type.
    2. In the Variable Name field, enter appealXML.
    3. Click OK. Your new variable (of type XmlObject) is created and displayed in the Receive Data tab.
  4. To close the node builder, click the X in the top right-hand corner.
  5. At run time, the document returned by the task owner that describes the reasons for appealing the resolution of the bug is assigned to the appealXML variable.

    The last step in designing the logic for the SoftCo business scenario is to define a node in the business process that returns the document containing the reasons for the appeal to the client. Note that the client is the same resource that starts the Resolution Approval business process.

To Design the Client Response in the Case of an onTaskAborted Message

  1. Click Client Response in the Palette, then drag and drop it onto the Request Approval business process, placing it on the process immediately after the onTaskAborted node in the Event Choice group.
  2. Rename the node from Client Response to Resolution Appealed.
  3. The business process is updated in the Design View, as shown in the following figure:


     
  4. Double-click the Resolution Appealed node in the Event Choice group to open its node builder.
  5. On the General Settings tab, in the Method Name field, change clientResponse1 to appealed.
    1. Click Add. A panel showing the data types you can use is displayed:

    2.  

      The appeal message returned to the business process from the Task control in the preceding node (onTaskAborted) is an (untyped) XML message. Therefore you need to use XML for this node.

    3. If necessary, select XML.
    4. If necessary, click the + beside Untyped to expand the list of Untyped XML objects available in your project.
    5. Select XmlObject.
    6. In the Name field, replace the default parameter name (x0) with appealXML.
    7. Click OK. The parameter specifications you made are displayed in the General Settings tab of the node builder. The parameter type and name are XmlObject and appealXML respectively.
  6. Click the Send Data tab. The Send Data tab opens and displays the Variable Assignment pane by default.
  7. Under Select variables to assign, select appealXML (XMLObject) from the drop-down list.
  8. To close the node builder, click X in the top right-hand corner.
  9. This step completes the specification of the callback method exposed to clients by the Resolution Approval business process.

  10. On the onTaskAborted branch, add a Finish node immediately after the Resolution Appealed node.
  11. This specifies that at run time the business process is terminated immediately after the appealXML document is sent to the client that invoked the business process.

    In the Design View, the completed Resolution Approval process should resemble the following figure.


     
  12. Select File—>Save All. Your work is saved.

This completes the design of the Event Choice group, and the Resolution Approval business process. To run and test the functionality of the business process you created using WebLogic Workshop's browser-based interface, proceed to Step 6. Run the Resolution Approval Business Process.

 

Skip navigation bar  Back to Top Previous Next