Building Your First Process with Oracle BPM

Overview

    Purpose

    This tutorial shows you how to build a simple Hello World application using Oracle BPM Suite 11g R1.  It also shows you how to deploy the process to the BPM server and test it in the BPM Workspace.

    Time to Complete

    Approximately 2 hours

    Introduction

    In this tutorial, you use Studio, the JDeveloper based IDE, to create a simple Hello World process.  This process demonstrates the use of a file service (implemented by a file adapter), user tasks (implemented by the Human Workflow engine), and conditional branching.  The conditions for the branching are determined through the use of a business object and a business rule (which is implemented by the business rules engine).  You also use a script task to initialize a variable.  After building the process, you deploy it to the BPM engine and test it in the runtime environment.

    Scenario

    There are two roles involved in the Hello World process, the sender of the message (in the Requester role), and a reviewer (in the Reviewer role).  The requester is prompted, through the Request Hello user task, to enter a Hello message, greeting, and a date for the message.  After the form is submitted, a business rule is applied to the message content to determine whether the message requires a review, based on the length of the greeting and message fields.

    If the message does not require review, the process flows to a script task, which initializes a variable needed by the next task, then the message is sent to the Write Message user task to be written to the file system.  If the message requires review, the reviewer is prompted to review the message and either accept or reject it.  If the message is rejected, it returns to the Request Hello user task so that the requester can correct the message.  If it is accepted, it goes directly to the Write Message user task for file processing.

    Hello World Process Model

    Hardware and Software Requirements

    The following is a list of hardware and software requirements:

    • Install Oracle BPM Suite 11g Release 1 (11.1.1.7)
    • Install Oracle JDeveloper Studio Edition 11g release 1 (11.1.1.7).  You should have also installed the SOA Suite Extension for JDeveloper.

    Prerequisites

    Before starting this tutorial, you should: 

    • Have added the Demo Community users to the WebLogic server's internal LDAP database.  You will map these users to the Hello World application roles. 
    • If you have not done this, Download and extract the SeedDemoCommunity.zip file containing the ANT files that will perform this task.  You will need to modify some parameters in the ANT build file to match your particular installation. Use this ReadMe file to assist you.

Creating the Basic Hello World Application

    In this section you create the basic starting point for the Hello World process using the JDeveloper Studio. This simple process contains just four flow objects: a start event, a user task ("Request Hello"), a service activity ("Write Message"), and an end event. The end user will be able to enter a Hello message, using the BPM Workspace. The message will be captured in a business object and passed to a file service, which, in turn will write the message to a disk file. Later, you expand upon this to add more complexity to the process.

    Basic Hello World Process Model

    You create several process elements throughout this section of the tutorial. The following naming convention will be used throughout this section:

    Name Description
    HelloWorld_OBE Application name
    HelloWorldProject Main project name
    HelloWorld_UI Project containing user task web form(s)
    HelloWorldProcess Process name

    Creating the Process Model

      Open JDeveloper Studio 11.1.1.7 from the Windows Start menu. If prompted to select a role, choose the Default Role.  Click OK

      Select Roles window

      Close the Daily tips window if it appears.

      Create a new application. Click the New Application bar in the left panel.


      The BPM Application wizard opens. Name the application "HelloWorld_OBE" and accept the default directory for storing application files (D:\JDeveloper\mywork). Select BPM Application in the Application Template panel.

      New Application window

      Click Next.

      In Step 2 of the Create BPM Application wizard, you create a project for the application. Enter "HelloWorldProject" as the Project Name. Notice that BPM and SOA are automatically selected for you as Project Technologies.  Click Finish


      In the upper left corner of the Studio window, you see the Navigator panel. This contains two tabs that will be important to you as you perform this tutorial: The Application Navigator tab and the BPM Project Navigator tab. Currently the Application Navigator tab is selected by default. You can see the HelloWorld_OBE application appearing in the drop-down list just above the panel, and the HelloWorldProject appearing as the parent node within the panel. The fact that it appears in italics indicates that there are unsaved changes.

      Navigation Panel

      Click Save All in the main toolbar.

      To create a new process in this project, first click the BPM Project Navigator tab. Then right-click on Processes and select New > Process.

      BPM Process wizard 1
      In the BPMN Process wizard, enter "HelloWorldProcess" as the process name. Select Manual Process. Click Finish

      BPMN Process #1

      The process model appears in the design editor panel in the middle of the Studio window. The tab name will be the same as the name of your new process.

      Click Save All.

      You may wish to close the other tabs as you will not be using these.  Click the X at the corner of the tab to close the tabbed pane.  All of these can be easily reopened later from either the menu or one of the navigator panels.

      Design Editor

      Notice that the model already contains three default flow objects.  The process begins and ends with two circular icons. The circle on the left is a Start event and the circle on the right is an End event. Connecting the two circles is a line that represents the flow of activities through the process. This is called the sequence flow and sometimes is referred to as the "transition line". Between the Start and End events is a User Task type activity.

      Change the name of the user task in the process model. Right click on it and select Properties.

      Select Properties

      When the properties dialog box appears, on the Basic tab, change the name of the user task to "Request Hello". Click OK.
      Name the User Task

      Do not worry about the warning icon indicating that no implementation has been defined. You will define this later.
      Click Save All.

      Add a service activity to the process.  First you will need to make room for another flow object on the sequence flow.  Click on the End event and drag it to the right, dropping it on the right side of the design panel, allowing enough room for the service activity to fit between the Request Hello user task and the End event.

      Make room for service activity

      From the flow objects drop-down menu, expand the Activity palette. 

      Add service activity

      Click the Service activity icon in the palette and drop it on the sequence flow between Request Hello and End. Drop it there. Notice that the transition line turns blue when the drop target area approaches the line.

      Important: The transition line must be blue when you drop the object in order for the transition line to be connected to the flow object.

      Drop the service activity on the sequence flow

      When you drop it, the Properties dialog box for the activity opens. On the Basic tab, change the activity name to "Write Message". Click OK.
      Click Save All. Your process should now look similar to this.

      Process model

    Creating the Business Object

      While it is possible to create a simple business object without using a schema file, it is less common. Therefore you will create the business object from a provided xsd schema file. After creating the business object, you declare a process data object (like a variable) of that type.

      Download the helloObject.xsd file and save it to a folder on your local machine.
      Create a business object based on the helloObject.xsd schema. This business object will be capable of storing multiple pieces of data related to the message that the user enters in the Request Hello user task. This object will be populated when the user enters the message.  It will then be passed to the Write Message activity so that the message can be written to a file.

      Business objects are stored in modules within the Business Catalog. In the BPM Project Navigator, expand the HelloWorldProject node. Right-click on Business Catalog and select New > Module.

      New Module

      When prompted to name the new module, enter "HelloTypes" and click OK.

      The HelloTypes module now appears beneath the Business Catalog node.

      HelloTypes Module

      Right-click the HelloTypes module and select New > Business Object.

      New business object

      Enter "HelloObject" as the Name and accept HelloTypes as the Destination Module.
      Select the Based on External Schema checkbox and click the Browse button to choose the external schema.

      Define the HelloObject business object

      In the Type Chooser window, click the Browse button in the upper right corner to import a new xsd file.  The Import Schema File window opens. 
      Select the Copy to Project checkbox and then browse to select the HelloObject.xsd file you just saved to your local file system.

      Define the HelloObject business object

      Click OK in the Import Schema File window. Also click OK in the next window 
      to confirm your choice.

      In the Type Chooser window, you can now see the structure of the HelloObject schema file.  Select HelloObject and click OK.

      Define the HelloObject business object

      The HelloObject now appears in the Business Object editor in the main panel of the Studio window. Notice the three attributes of this object type: date (Time), greeting (String), and  message (String). 
      Close the HelloObject editor by clicking the X on the tab.

      HelloObject in editor

      You should also see the HelloObject appearing in the Business Catalog under HelloTypes, and in the Structure Panel (assuming HelloObject is selected).

      Structure Panel

      Click Save All.
      Now create a process data object of type HelloObject so that you can use it in your process. If the HelloWorldProcess is still open in the design editor, click anywhere in the design editor to set the context of the Structure panel, causing it to show the HelloWorldProcess structure. (If it is not open, select it in the BPM project navigator.)
      A detailed outline of the process structure now appears in the Structure panel.

      Right-click on Process Data Objects and select New.

      Structure Panel

      In the Create Data Object popup window, enter hello as the Name. In the Type field, select <Component>.  Then click the Browse button to select the component type.

      Structure Panel

      In the Browse Types window, select HelloObject and click OK.

      Structure Panel

      Back in the Create Data Object window, click OK again.
      The hello data object now appears in the Structure panel.

      Structure Panel

      Click Save All.

    Implementing the User Task

      Every user task must be bound to a human task service that provides its implementation. In this section, you create a human task for the Request Hello user task. Then you create a web form for the user to enter the hello message and greeting.

      Create the human task that implements the Request Hello user task.

      Right-click the Request Hello user task and select Properties.

      Click the Implementation tab. Next to the Human Task field, click the plus sign button to create a new human task.

      Structure Panel

      In the Create Human Task dialog box, enter or select the following values for fields in the top portion of the dialog.
      Field Value
      Name SayHello
      Title Please Enter a Hello Message
      Outcomes Submit
      Pattern Initiator

      Add a parameter by clicking the plus icon above and to the right of the Parameters panel as shown below.

      Create Human Task window

      This opens the Data Object window, displaying available data objects that you can drag into the Parameters panel. Click the hello data object and drag it into the parameters panel. Select the Editable checkbox for the new parameter. 

      Structure Panel

      Click OK. This closes both windows and you are returned to the Properties window for the Request Hello user task.
      Notice that the parameter has been named HelloObject.   The scope of this parameter is the human task.  Its value does not persist beyond the completion of the human task. 
      We want the data that the user enters in the hello message to be accessible from the Write Message activity. 
      Studio mapped the HelloObject parameter to the hello process data object (whose scope is the entire process) when you added this parameter.

      Click the Data Associations link in the Properties window to view this automatic mapping.
      Select the Output tab.  You can see that the helloObject from the Request Hello human task on the left has been mapped to the hello data object in the HelloWorldProcess on the right.

      Structure Panel

      Click OK to close the Data Associations window.  Also click OK to close the Properties window.
      Click Save All.
      Now you provide a web form for the user to enter the Hello message, ensuring that the form is linked to the hello data object.
      Right-click the Request Hello user task and select Open Human Task.
      When the human task editor opens, click the Create Form drop-down list in the editor toolbar and select Auto-Generate Task Form.

      Auto-Generate a Task Form

      The Create Project window opens. It is necessary to create a separate project to contain UI elements (web forms). Enter HelloWorld_UI as the Project Name and accept the default directory. Click OK when finished.

      Create the UI Project

      It will take several seconds (even up to a minute, depending on resources) to create the form and open the ADF page editor. Eventually, you will see the editor shown below (partial view). The highlighted section is the portion that will be visible to the end user. Notice the Date, Greeting, and Message fields.

      Form in page editor

      Select the Message field as shown above. When you do so, the properties for this field appear in a panel in the lower right corner of the Studio window.
      Expand the Appearance accordion panel within this panel and change the value of the property to 5.

      Message field properties

      Tab out of the field so that the change will take effect in the form.

      Message field properties

      Click Save All. Close all of the tabbed panels except for the HelloWorldProcess tab.

    Implementing the File Service

      Here you create the implementation for the Write Message service activity using the SOA Composite editor.

      Click the Goto Composite Editor button on the design editor toolbar as shown below.

      Open Composite Editor

      The SOA Composite editor opens. The HelloWorldProcess BPMN component and the SayHello human task component are shown in the composite editor.  Notice that the SayHello human task is
      "wired into" the process.  This is because the SayHello component is associated with a user task on the process flow.  It implements the user task.

      Composite diagram

      Create a File Adapter service. If you do not see the Component Palette tab on the right side of the Studio window, open it from the View menu. Find the File Adapter service adapter in the Component Palette.

      File Adapter in Component Palette

      Drag it to the External Reference column of the Composite Editor and drop it there.

      Composite Editor view

      The Adapter wizard opens when you drop it.

      Click Next on the Welcome page of the Adapter Configuration Wizard
      On the Service Name page of the wizard, name the service MessageWriter. Click Next.

      File Adapter configuration wizard - 2

      On the Adapter Interface page, select Define from operation and schema (specified later). Click Next.

      File Adapter configuration wizard - 3

      On the Operation page, select Write File. The Operation Name will be pre-populated with the name Write. Accept this value and click Next.

      File Adapter configuration wizard - 4

      On the File Configuration page, select Physical Path as the Directory specified.  Enter a dot ('.') for the "Directory for Outgoing Files (physical path)" field.
      Also enter a File Naming Convention of:  
          Hello_%SEQ%.xml 

      File Adapter configuration wizard - 5

      Click Next.

      In the Messages page, you determine what should be written to the file. Click the magnifying glass icon next to the URL field to open the Type Chooser popup.

      Expand Project Schema Files > HelloObject.xsd to find and select HelloObject as shown below. Click OK to accept the selection and return to the Messages page of the wizard.

      File Adapter configuration wizard - 6

      Click Next in the Messages window.

      File Adapter configuration wizard - 7

      Click Finish in the final page of the wizard and then click Save All.

      The service is created and appears in the SOA Composite editor.  At this point, it does not appear, however, in the Business Catalog.

      Close and reopen the HelloWorld_OBE application to allow Studio to incorporate the new MessageWriter service into the Business Catalog.
      From the Application Navigator drop-down menu, select Close Application. When the application has close,  click Open Application and browse to
      \JDeveloper\mywork\HelloWorld_OBE.
      Double-click the helloworld_obe.jws file.  The application reopens.

      In this step, you wire the MessageWriter service to the Write Message activity in the process. Open the HelloWorldProcess in the design editor by double-clicking the item in the BPM Project Navigator.

      Right-click the Write Message activity and select Properties. Click the Implementation tab.

      In the Message Exchange section, select Service Call as the Type.  The window changes to include a Service Call section.

      Click the Browse button (magnifying glass icon) next to the Service field to browse for a service. The Service popup window appears, displaying the MessageWriter service you just created. Select it and click OK in the Service popup.

      Implement the Write Message activity

      Back in the Properties window,  notice that the Operation field has been automatically set to write.

      Click the Data Associations link to map data into the MessageWriter service.

      Data Associations link

      In the Data Associations window, select the Input tab. Click the hello data object from the HelloWorldProcess panel and drag a line to the right, to connect it to the helloObject argument in the Write Message panel.  Beneath the two panels, you can see that the value from hello will be copied to the helloObject argument.

      Data Association window

      Click OK in the Data Associations window to save the mapping and return to the Properties window.

      Click OK in the Properties window. Click Save All.

Enhancing the Basic Hello World Process

    In this section, you enhance the basic process you just built by adding a review capability for the message entered by the user. You add another business object to hold review-related data and use this business object in conjunction with a business rule that tests the length of the greeting and message. You also add another human interaction that allows the user with the Reviewer role to review the entered message and accept or reject the message.

    After adding the new flow object, you change the process flow so that it conditionally branches to the Review Message activity and potentially back to the Request Hello activity if the message was rejected. A script task will also be needed in order to initialize a variable used in the conditional branching logic.

    You begin the enhancement by changing the name of the role assigned to the user who executes the Request Hello activity to something more meaningful. Then you add a new role for the user who reviews the message.

    Adding the ReviewObject Business Object

      Currently all the activities of process are assigned to a default role called "Role". You now create a new role called "Requester" and assign that role to the swim lane containing the entire process flow.

      In the process design editor, right-click on Role at the left edge of the swim lane and select Properties.

      Open Role properties

      In the "Role properties" window, click New. In the Role popup window, enter Requester in the Name field and click OK.

      Create new role

      With the "Role properties" window still open (and now displaying the Requester role as the selected role), create another new role called Reviewer. Click OK in the Role popup window.

      Create a second new role

      In the "Role properties window", change the selected role back to Requester. Notice that there are now several roles appearing in the drop-down list of roles. Click OK to close the "Role properties" window.

      Select Requester role

      Click OK to close the "Role properties" window. Notice that the Requester role now appears in the swim lane.
      Add another swim lane beneath the Requester swim lane. Right-click the bottom portion of the swim lane and select Add Role.

      Add another swim lane

      When the "Role properties" window opens again, select the Reviewer role from the drop-down list and then click OK.

      Select Requester role

      Click Save All.
      Add a new business object in the same manner that you did in the Creating the Business Object section above.

      Download the ReviewObject.xsd file and save it to a folder on your local machine.

      Follow Step 3 of that section, placing the new business object in the HelloTypes module.

      Name the object ReviewObject and, in the Import Schema window, select ReviewObject.xsd from the file system, making sure to copy it to the project.

      Select ReviewObject.xsd

      When you have finished creating the object, the Business Object editor will open, displaying ReviewObject as shown below.

      ReviewObject in Business Catalog

      Click Save All and close the Business Object Editor.  The ReviewObject should now appear in the Business Catalog in the HelloTypes module. 
      Declare a process data object of type ReviewObject in the same manner that you did in the Creating the Business Object section above. Follow the instructions in Step 5, substituting review as the data object name.

      review process data object

      Add one more process data object of type String, called reviewOutcome. Follow the same procedure as the previous step, except choose String as the type.

      reviewOutcome process data object

      You should now see three process data objects in the Structure panel as shown below.

      Process data objects

    Adding a Business Rule

      Add a business rule to the process model.

      Begin by making more room on the sequence flow between Request Hello and Write Message.

      Process model modified

      From the flow objects drop-down menu, expand the Activity palette. 
      Click the Business rule activity icon in the palette and drop it on the sequence flow between Request Hello and Write Message. Be sure that the transition line is blue when you drop business rule.

      Drop the busines rule on the sequence flow.

      The Properties dialog for the business rule appears when you drop the object. Enter Review Needed in the Name field. Click OK.

      Name the busines rule.

      Click OK.
      Open the Composite editor by clicking the Goto Composite Editor button on the Design editor toolbar.

      GoTo Composite Editor button

      Add a Business Rule component to the Composite Editor. From the Component Palette panel on the right, click and drag a Business Rule from the Service Components section of the palette and drop it in the Components column of the Composite Editor.

      Create Business Rules dialog

      When you drop the component, the Properties dialog appears. Enter HelloRules in the Name field. Then click the green plus button above the Inputs/Outputs section and select Input...

      Add a rule input

      The Type Chooser popup window appears. Expand the second HelloObject.xsd entry, and then select the HelloObject beneath it. Click OK.

      Add a rule input

      In the Create Business Rules dialog, click the green plus button once more and this time select Output... When the Type Chooser popup window appears, expand the second ReviewObject.xsd entry and select ReviewObject. Click OK.

      Add a rule output

      Back in the Create Business Rules dialog, click OK.

      Add a rule output

      Click Save All.
      Now wire the implementation that you just created (the HelloRules business rule) to the ReviewNeeded business rule activity in the BPM process. Click the HelloWorldProcess tab to bring the focus back to the BPM Design Editor.
      Right click ReviewNeeded to open its properties window.   Click the Implementation tab.
      Click the browse button to the right of the Business Rule field. In the Browse Business Rules popup window, select HelloRules and click OK.

      Wire the implementation to the activity

      Click the Data Associations link to open the Data Associations editor.  In this window, you map process data objects (hello and review) to the Inputs and Outputs that you defined for the HelloRules business rule implementation.

      Click the Input tab. In the left column, click the hello process data object and drag it to the helloObject argument of the Review Needed business rule in the right column.

      Map input data.

      Now click the Output tab. Click and drag the reviewObject argument from the left column to the review process data object in the right column.

      Map output data.

      Click OK in the Data Association editor. Then click OK in the Properties window. Click Save All.

    Defining a Decision Table for the Business Rule

      In this section, you define a set of rules that will be applied when the user enters a hello message and greeting.  The following table illustrates what those rules are and how they will be applied.

      Rules table.

      The lengths of the HelloObject.greeting and HelloObject.message strings will be evaluated. You will define four rules that determine the combination of greeting and message lengths and then set the appropriate values to the ReviewObject properties: reason and review.

      For example, if the greeting length is medium and message length is short, reviewObject.reason would be set to "Length is too short" and reviewObject.reason would be set to "true". Consequently, the process would flow to a Review Needed activity and could be accepted or rejected by the reviewer.

      A decision table can be designed in many different ways. In our scenario, the decision table consists of four elements as described below.

      • A set of Conditions: In this case, each condition is the length of either the greeting or the message string variable.
      • A Range of Values, called a bucketset : For example, a variable might be <5 characters in length, or 5-50 characters in length, and so on.  These are ranges within a bucketset.
      • An Action: This is the act that should occur when a rule is evaluated.  For example, the review property might be set to "true".
      • A Rule: This is a specific mapping of condition > range > action.  Each of the last four columns in the table above represents a rule.

      A decision table is created in five high-level steps:

      1. Define the conditions (Step 2 below)
      2. Define a bucketset (Step 3)
      3. Assign the bucketset to each condition (Step 4)
      4. Define the action (Step 5)
      5. Define the rules (Steps 6-9)
      Open the Rules Editor.

      In the BPM Navigator, expand Business Catalog > Rules > Helloworldproject. Double click on HelloRules.rules.

      Open Rules Editor.

      The Rules Editor opens and you can begin defining the various elements of this "Ruleset" (ruleRuleset_1).
      Create a decision table. Click the down arrow next to the green plus sign button on the toolbar and select Create Decision Table from the drop-down menu.

      Create Decision Table.

      The Rules Editor changes to a table view.  You may wish to double click the HelloRules.rules tab to make the editor panel fill the whole Studio window. This will give you more room to work on the decision table. You can always bring the editor tabbed page back to its previous size by double clicking it again.

      Change the default name of the decision table from DecisionTable_1 to ReviewDecisionTable. Click on the field containing the default name. A text field appears below it. Enter the new name and click Enter to accept the value.

      Change the name of the decision table.

      Define two conditions for the decision table to analyze:
      • The length of helloObject.greeting
      • The length of helloObject.message

      Add the first condition by clicking on the <insert condition> field in the table as shown below. This will automatically add the C1 condition.

      Add a condition.

      Double-click the C1 condition default value in the Conditions column. This opens a drop-down menu displaying available functions and data object types. 
      Expand HelloObjectType > greeting and click the length function.

      Conditions column.

      The C1 condition expression now appears in the Condition column.

      Condition expression.

      Add a second condition by clicking the green plus sign above and to the right of the Conditions column. Select Condition from the drop-down menu.

      Add a second condition.

      Double click the C2 condition to edit it as you did previously. Notice that, this time, the condition has a default value of HelloObjectType.

      Add a second condition.

      When the drop-down menu appears, expand HelloObjectType > message and click the length function.

      Add a second condition.

      Both conditions are now defined. Click Save All.
      The rule will compare each condition against a range of values called a "bucketset". Click the Bucketsets node in the left panel of the Rules Editor to create the bucketset.

      Bucketsets node.

      Click the green plus sign button and select List of Ranges from the drop-down menu.

      Select List of Ranges

      A new bucketset row is inserted. With this row selected, click the pencil icon to edit the list of ranges.

      Select List of Ranges

      In the Edit Bucketset window that appears, change the value of the Name field to Lengths. Leave the Data Type field set to int.

      The Range Bucket Values table has an initial default row in which the Endpoint is set to -Infinity. Click the green plus sign button twice more to add two more rows.

      Range Bucket Values table

      Change the 0 (zero) Endpoint value to 5 by clicking on the value and typing the new value. Notice that this changes the Range for this row to [5..50] and also changes the Range of the row whose endpoint is -Infinity to <5.

      Change the Alias for each row to Short, Medium, and Long as shown below. Double clicking on the default Alias value makes it editable.

      Completed Range Bucket Values table

      Click OK to close the Edit Bucketset window.  Click Save.
      Assign the Lengths bucketset to each condition in your conditions table. Click the Ruleset_1 node in the Ruleset editor to bring back the decision table editor.

      Click the C1 condition to select it and then click the Local List of Ranges drop-down list above the Conditions table and select Lengths.

      Assign Lengths bucketset to C1

      Do the same thing for the C2 condition.

      Assign Lengths bucketset to C2

      You are almost ready to start defining the rules to be applied to each combination of range of values and condition. First you must define an Action to be performed when a rule is implemented.

      Create a new Action. In the Actions panel, click the <insert_action> field and select Assert New.

      Assert new action

      Once the assert new line appears, right-click it and select Edit.

      The Action Editor window opens. Select ReviewObjectType from the Facts panel. The properties of this object type now appear in the Properties panel in the lower portion of the window. Select the Parameterized and Constant checkboxes for both the reason and the review properties.

      Assert new action

      Notice that an assert new( ) statement has now been constructed in the Value field. It instantiates a ReviewObject with values for the reason property (a String), and the review property (a String). You can see this assert statement in the screenshot above. Each rule that you define in the next step will provide specific values for these parameters.

      Click OK, then Save.

      Define the first rule (R1). Click on the C1 row beneath the R1 column.  A drop-down list appears representing the bucketset you assigned to this condition.  Select Short and click OK.  

      Assign value for the C1 condition for Rule 1

      Click the R1 column for the C2 row. This is the length for the message property. In this case, it doesn't matter what the length is, so select the Specify value as Don't Care checkbox. Notice that a dash (-) is placed in the C2 row for this condition.

      Click OK.

      Assign value for the C2 condition for Rule 1

      In the Actions panel, click the checkbox in the column to the right of the assert new statement, indicating that you do want the ReviewObject asserted for this rule. Then click the row beneath the checkbox, next to the reason property. When the text field appears, type: "Greeting is too short". Hit Enter when finished.

      Define an action for Rule 1

      Click the column next to the review property and enter the value "true". Hit Enter when finished.

      Define an action for Rule 1

      You have just defined Rule 1, indicating that if the greeting is "Short" (<5 characters), the message is subject to review (review = "true") and the ReviewObject.reason should be set to "Greeting is too short".
      Define the second rule. Click the green plus sign button above the Rules column and select Rule.

      Add Rule 2

      Notice that when the new rule column is added, it is added with the heading R1 and the rule you just defined is moved over to the right, under the heading R2.

      Rule 2 position

      Beware: When you make the first edit to the new rule, the name will revert to the intended name, "R2" and it will be moved back to the right side of R1. Always be sure that you are editing the rule you intend to edit.

      Make edits to the new rule, just as you did with the previous rule, using the following table to guide you:

      Section of Decision Table Property Value to Set
      Condition
      HelloObject.greeting.length( ) Medium
      Condition
      HelloObject.message.length( ) Short
      Action
      ReviewObject.reason "Length is too short"
      Action
      ReviewObject.review "true"

      Rule 2 complete

      Define the last rule that appears in the table as shown at the beginning of this section. Define it in the same way you defined the rule in the preceding step. The table below provides the values you will use.
      Section of Decision Table Property Value to Set
      Condition
      HelloObject.greeting.length( ) Long
      Condition
      HelloObject.message.length( )  -
      Action
      ReviewObject.reason null
      Action
      ReviewObject.review "false"

      Note that you must select the null from the drop-down list, rather than type it into the text field.

      Rule 3 complete

      Run the Gap Analysis tool to automatically create the final rule. It will determine which conditions have not been accommodated by the existing rules. Click the Gap Analysis button on the Decision Table editor toolbar.

      Gap Analysis button

      The Gap Analysis window opens showing the rule that it determined was missing. Click the checkbox in the column header to allow the rule to be included in the decision table. Click OK.

      Gap Analysis window

      The rule now appears in the decision table as Rule 3 and the rule that you defined in the last step moves to the Rule 4 position.

      Assert the action for Rule 3 (Column R3) and add the following action values:

      • reason = null
      • review = "false"

      All four rules

      Click Save and close the HelloRules.Rules tab.

    Adding the Review Message User Task

      Add a new user task activity to the HelloWorldProcess.

      From the design editor toolbar, expand the Interactive drop-down palette and click the User icon.

      Interactive drop-down palette

      Drop the user task into the Reviewer swim lane, just below the Review Needed business rule task.

      Drop user task in Reviewer swim lane

      When the Properties window opens, name the activity Review Message.

      Name the user task

      Click the Implementation tab to define the a human task implementation for the activity. Click the green plus sign icon to create a new human task.

      Name the user task

      In the Create Human Task window, enter values into the Name and Title field as shown below. Accept the other default values.
      • Name: ReviewMessage
      • Title: Review the Message

      Human task properties

      Click the green plus sign icon next to the Properties panel as shown above to add parameters (this defines the payload for the human task.)

      The Data Object popup window appears next to the Create HumanTask window. Drag the hello and review process data objects into the Parameters panel. Select the Editable checkbox for the hello object only.  Also drag the reviewOutcome data object into the Outcome target field.

      Note: When a parameter is marked "editable", you are able to map the parameter as output from the human task. Since the reviewer will not edit the review object, it does not need to be mapped out of the human task. Recall that the review object contains the outcome of the business rule. The outcome of the task (in this case, either "APPROVE" or "REJECT") is now mapped to the reviewOutcome data object.

      Setting the payload

      Click OK in the Create Human Task window. Click OK in the Properties window. Click Save All.
      Create a task form for the ReviewMessage human task. Right-click the Review Message user task in the HelloWorldProcess process model. Select Open Human Task from the context menu.

      Open Human Task

      In the Human Task Editor, select Auto-Generate Task Form from the Create Form drop-down menu.

      Auto-Generate task form

      When the Create Project popup window appears, enter ReviewMessage_UI as the project name. Click OK.

      UI Project name

      After a lengthy delay (up to minute), during which time several interim screens will appear, the taskDetails1.jspx form will appear in the page editor.

      The payload can be seen in the Contents panel of the web page. Notice that both the hello and review objects are included.

      Task form shown in the page editor

      Select the Message Input Text field as shown above. The Property Inspector panel now displays the properties of this field. In the Appearance section, change the Rows property to 5 and hit Enter.

      Change the Rows property of Message field.

      Click Save All and then close all of the tabbed pages except the HelloWorldProcess tab.

    Adding Conditional Branching

      Add an Exclusive Gateway to the process model.

      Begin by moving the End event and the Write Message activity to the right to make room for the exclusive gateway.

      Process model after moving flow objects to the right

      From the Gateway drop-down menu, click Exclusive.

      Exclusive Gateway

      Drop it on the sequence flow between Review Needed and Write Message.

      Drop exclusive gateway

      Remember that the line must be blue when you drop the object.

      When you drop it, the Properties window opens. Change the name of the gateway to g1 and click OK.

      Exclusive gateway Properties window

      Add a second exclusive gateway to the sequence flow between g1 and Write Message. Follow the same procedure you did in the last step. Name this gateway g2.

      Second exclusive gateway added.

      Add a conditional sequence flow from g1 to Review Message. Right click on g1 and select Add conditional sequence flow.

      Exclusive gateway Properties window

      Connect the conditional sequence flow to Review Message.  Reshape the sequence flow as shown below by clicking the flow and dragging it into position.

      Conditional sequence flow added.

      Add a default sequence flow from Review Message to g2. Right-click on Review Message and select Add default sequence flow.

      Default sequence flow added.

      Connect the other end of the sequence flow by clicking on g2. Reshape the transition line as shown below, as you did in the previous step.

      Model showing both sequence flows added.

      Add a conditional sequence flow from g1 to Request Hello. Reshape the transition line as you have the other two transition lines. (It will be obscured by the existing main sequence flow) It should look like this when you've finished.

      Conditional flow from g2 to Request Hello.

      Define the condition for the sequence flow from g1 to Review Message. Double-click the transition line between the two objects. The Transition properties window opens.

      On the Description tab, name the transition Review Needed.

      Transition properties: Description tab

      Click the Properties tab. On this tab, you define an expression whose outcome determines whether the process flows down this transition to the Review Message activity. In other words, you define the condition for the conditional sequence flow. Click the Expression Builder button on the right side of the window.

      Transition properties: Properties tab

      The Expression Builder opens. Build the expression in 3 steps:
      1. In the Variables panel, expand review and select the review attribute.
      2. Click the Insert Into Expression button. This puts review.review into the Expression panel at the top.
      3. In the Expression panel, add:

      = "true"
      to the existing variable reference.

      Expression builder window

      Click OK when finished to close the Expression Builder.

      Click OK to close the transition properties window.

      Define the condition for the sequence flow from g2 to Request Hello. Double click on the transition line between the two objects. The transition properties window opens.

      On the Description tab, name the transition Message Rejected.

      Transition properties window

      Click the Properties tab. Open the Expression Builder and define the following expression, using the same procedure as you did in the last step:

      reviewOutcome = "REJECT"

      Expression builder window

      Click OK when finished to close the Expression Builder.

      Click OK to close the transition properties window.

      Click Save All.

      Your process should now look like this:

      Process model complete to this point

    Adding a Script Task

      When the process flow reaches the second gateway (g2), it checks the value of the reviewOutcome data object. There must be a value in the reviewOutcome data object in order for the process to move on to the Write Message activity. If the value is REJECT, the process returns to Request Hello.

      When a message is flagged for review, the reviewer clicks either REJECT or APPROVE, thereby populating the reviewOutcome data object.

      If the process skips the review branch and moves from the g1 gateway directly to the g2 gateway, the reviewOutcome data object has no value.

      In this section, you add a script task to initialize reviewOutcome between g1 and g2.

      From the Activities drop-down menu on the design editor toolbar, click Script and drop it on the transition line between g1 and g2.

      Drop script task on transition line

      When the Properties window opens, name the activity InitApproval on the Basic tab and click OK.

      Script task named and added to process

      Define the implementation for the InitApproval task. Right-click InitApproval and select Properties.

      When the Properties window opens, click the Implementations tab, then click the Data Associations link.

      Data Associations link

      In the Data Associations window, click the function button (fx) from the toolbar and drop it into the center panel as shown below. This opens the Expression Builder window where you can define
      an expression to be copied to the reviewOutcome data object.

      Drop fx icon into the center panel

      In the Expression Builder, expand the Data Objects folder in the Variables panel and select reviewOutcome. Click Insert Into Expression, adding it to the expression panel.  Then add:  ="APPROVE" to complete the expression.

      Build expression

      Click OK to close the Expression Builder.

      In the Data Associations window, drag a line from the fx icon (which represents the expression you just defined) to the reviewOutcome data object in the right panel.

      Build expression

      Click OK to close the Data Associations window.

      Click OK to close the InitApproval task properties window.

      Click Save All. The Hello World process is now complete!

Deploying and Testing the Application

    In this section, you deploy the Hello World application to the BPM engine running in the WebLogic server that is part of your SOA installation. This tutorial assumes that your server is running on your local machine (localhost). If it is running on a remote machine, you need to know the server hostname and port.

    In either case, you also need to know:

    • The WebLogic domain in which SOA is running
    • The username and password for the WebLogic administrative user
    • The name of the WebLogic server instance to which you will deploy.   This tutorial assumes a single server configuration (i.e. not managed instances), and will deploy to the Admin Server

    Before deploying the application, you connect to the internal LDAP realm within the WebLogic server and map the Reviewer and Requester roles to a user in the LDAP directory.  When you seeded the DemoDB as a prerequisite to this tutorial, you populated the LDAP realm.  We will map one of those users to the roles.

    After deployment, you run the Oracle BPM Workspace to test the Hello World application.

    Mapping Application Roles to an LDAP User

      In the BPM Project Navigator, expand the HelloWorldProject and right click on the Organization node, selecting Open.
      Open Organization Editor
      Add user members to the Requester application role. In the Organization editor, the Roles tab is selected by default and all application roles are displayed. Select the Requester role by clicking its checkbox.

      Click the Browse button (magnifying glass icon) to the right of the Members panel.

      Browse for user members
      The Identity Lookup window opens. Studio is not yet aware of your SOA/BPM server, so the only application server that appears is the Integrated WebLogic Server that was installed with JDeveloper.

      Create a new profile for your SOA / BPM server. Click the green plus sign icon next to the Application Server field to launch the Create Application Server Connection wizard.

      Create new application server profile

      In the Name and Type page of the wizard, enter BPMServer. Make sure that the Connection Type is WebLogic 10.3. Click Next.

      Name and Type page

      In the Authentication page of the wizard, enter weblogic as the Username and welcome1 as the Password (or substitute your weblogic password). Click Next.

      Authentication page

      In the Configuration page of the wizard, enter your WebLogic Hostname (localhost used here). Accept the default values for Port and SSL Port, and enter domain1 in the WebLogic Domain field. Click Next.

      Configuration page

      In the Test page of the wizard, click the Test Connection button. You should see results similar to those shown below. If not, click the Back button, correct any errors and test again.

      Test page
      Click Finish.

      You are now returned to the Identity Lookup window.

      Select BPMServer from the Application Server list. After a few seconds, Studio will connect to the LDAP server in the BPM server and you see jazn.* appearing in the Realm field.

      Click the browse icon next to the User Name field to bring up a list of all users in the Demo Community from the LDAP server. Select jcooper from the list and click the Select button.

      Identity Lookup window

      jcooper will appear in the Selected Users panel of this window. Click OK to return to the Organization editor.

      jcooper appears now as a user member of the Requester role.

      Organization editor: Requester role

      Follow the same procedure as in the previous step to add jcooper to the Reviewer role as well.

      Organization editor: Reviewer role

      Click Save All and close the Organization editor.

    Deploying the Process

      When you deploy a BPM application, there are actually two pieces that get deployed: a SOA composite application, and a web application containing the user interface (UI) modules.

      While it is possible to deploy both of these with a single deployment, a redeployment would fail. Therefore, you will deploy the composite application first, then create a custom deployment profile to deploy the UI modules.

      Deploy the composite application.

      In the Application Navigator, right click the HelloWorldProject and select Deploy > HelloWorldProject.

      The Deploy HelloWorldProject wizard opens.

      In the "Deployment Action" page of the wizard, select Deploy to Application Server and click Next.

      In the "Deploy Configuration" page, click the Overwrite any existing composites with the same revision ID checkbox, but deselect the Keep running instances on after deployment checkbox.

      Deploy Configuration page

      In the "Task flow deployment" page, do not select any of the checkboxes. We do not want to deploy any task flows here. Click Next.

      Task flow deployment page

      In the "Select Server" page, select BPMServer. Click Finish.

      Select Server page

      Check the Deployment tab in the Log panel in the lower central portion of the Studio window to watch the progress and determine when deployment has finished. The SOA composite is deployed as a JAR file, called sca_HelloWorldProject_rev1.0.jar.

      Deployment log

      Deploy the UI modules.

      Select Application > Application Properties from the main menu.

      Menu: Application Properties

      The Application Properties dialog opens. Select the Deployment node in the left column. In the right column, you see the existing deployment profiles - one for each of the task flows you created. You create a custom deployment profile now that will deploy both task flows together in one web application.

      Click the New button to create a new deployment profile.

      Deployment properties dialog

      The "Create Deployment Profile" window opens. Name the profile HelloWorldOBE_UI. Click OK.

      Create Deployment Profile window

      The "Edit EAR Deployment Profile Properties" window opens. Select Application Assembly in the left panel. In the Application Assembly panel, select the HelloWorld_UI and the ReviewMessage_UI checkboxes.

      Click OK.

      Assembly Profile window

      Click OK again in the Application Properties window.

      Deploy the UI modules using the custom deployment profile. From the Application menu, select Deploy > HelloWorldOBE_UI.

      Deploy the UI modules

      The Deployment wizard opens. On the Deployment Action page, select Deploy to Application Server. Click Next.

      Deployment Action page

      On the Select Server page, select BPMServer. Click Next.

      Select Server page

      On the Weblogic Options page, click the Deploy to selected instances in the domain radio button. Then select the Admin Server from the list of standalone servers and clusters.

      Note: Your list of servers may be different than what is shown in the screenshot.

      Click Next.

      Weblogic Options page

      Review the Summary page information and then click Finish.

      Review the Deployment tab of the Log panel as you did earlier to determine when the deployment has finished. Notice that the task flows (UI modules) were deployed as a web application in the form of an EAR file.

      Deployment log

    Testing the Process in BPM Workspace

      Open a browser and enter the following URL:

      http://<your server hostname or localhost>:7001/bpm/workspace

      When the Welcome page of the Workspace appears, enter jcooper in the Username field and welcome1 in the Password field. Click Log In.

      BPM Workspace: Login

      The main workspace window opens.

      Instantiate the process. Select Applications in the left panel. Then click the HelloWorldProcess link.

      BPM Workspace: Create Instance

      This action executes the first task of the process, Request Hello.

      Process model

      For the first test, enter a message that will not require review. In the Please Enter a Hello Message browser window that appears, enter a value in the Date field by clicking the calendar icon and selecting a date. Also enter values in the Greeting and Message fields.

      Both the Greeting and the Message field values should have a length greater than 5 characters in order to avoid review.

      Click Submit to save the values and close the window.

      Enter a Hello Message popup window

      After submitting the message, the process goes to the ReviewNeeded business rule. Since both the Greeting and the Message are considered "Medium" in length, the message does not require a review. Hence the process goes through the g1 gateway, the reviewOutcome data object is initialized in the script task, and the process flows on through the g2 gateway to the Write Message task.

      Process model

      Write Message is a service task, rather than an interactive task, therefore there will be no indication of its action in the Workspace.

      Open the file that was created by the Write Message implementation. Recall that you configured the file adapter to write the file to the relative path "." (dot). This is relative to the domain1 directory within the WebLogic file structure.

      Locate and open the file:

      <path to your Middleware Home>/user_projects/domains/domain1/Hello_1.xml

      Open it in a text editor or browser to view the outcome from your process.

      Hello_1.xml location

      It should look something like this:

      Message shown in browser

      Create another instance of the Hello World process by once more clicking the HelloWorldProcess link. (You may need to log in again if your session has timed out.)

      This time, enter a message that will be routed to the Review Message user task.

      When the "Please Enter a Hello Message" window appears, enter a date and a greeting that has length < 5. Leave the Message field blank. Click Submit.

      Enter a Hello Message

      The process now flows, as before, to the business rule where the greeting is found to be "Short". As you'll recall, when the greeting is "short", the message requires review, regardless of what is in the Message field. Consequently, the process now flows to the Review Message task, which is assigned to the Reviewer role.

      Process model

      Remember that jcooper has both the Requester and the Reviewer roles. In order to see the Review Message task that has been routed to him, click the Views tab in the left column, and then click the My Tasks (0) link. As soon as you click it, the (0) is replaced by (1), reflecting the number of tasks currently awaiting jcooper's attention.

      The Review the Message human task can now be seen in the Inbox.  Click it to see the details in the lower panel of the Inbox.

      Tasks in Inbox

      In the details panel, you can see the taskflow form that you created for this activity, containing form elements for both the HelloObject and the ReviewObject. Notice that the ReviewObject attributes have been assigned by the Business Rules engine after executing the business rule for this message.

      Review Message form

      Click Reject when you have finished examining the details.

      The process now flows to the g2 gateway where the value of the reviewOutcome data object is examined. It has been set to REJECT by the reviewer, so the process now flows back to Request Hello.

      Process model

      The Please Enter a Hello Message link appears in the Inbox. This is the title string for the human taskflow associated with the Request Hello task. Previously, this task did not appear in the Inbox because it was opened in a separate browser window immediately upon instantiation of the process. This time it appears in the Inbox.

      Request Hello appearing in Inbox

      Click the link to view the input form and enter a more appropriate message that does not require review as you did in Step 3. Click Submit when finished.

      The process now flows through the two gateways to the Write Message activity and to the End activity. The Inbox is now empty. The process has completed.

      Log out of the Workspace. The tutorial is finished!

Summary

    In this tutorial, you have learned how to create a simple process that illustrates some of the basic features of Oracle BPM's modeling and implementation capability. This is just a start. However, it has given you hands on exposure to some of the key benefits of the product such as:

    • Modeling complex business logic with the Studio IDE
    • Creating business rules with complex decision tables
    • Creating auto-generated forms for human interaction
    • Moving and persisting data throughout a business process
    • Integrating a business process with external systems
    • Testing a process using the BPM Workspace

    Resources

    Credits

    • Lead Curriculum Developer: Jill Moritz
    • Other Contributors: Heidi Buelow

To navigate this Oracle by Example tutorial, note the following:

Hide Header Buttons:
Click the title to hide the buttons in the header. To show the buttons again, click the title again.
Topic List:
Click a topic to navigate to that section.
Expand All Topics:
Click the button to show or hide the details for the sections. By default, all topics are collapsed.
Hide All Images:
Click the button to show or hide the screenshots. By default, all images are displayed.
Print:
Click the button to print the content. The content that is currently displayed or hidden is printed.

To navigate to a particular section in this tutorial, select the topic from the list.