| Modeling and Implementation Guide for Oracle Business Process Management |
This chapter describes how to implement business rule tasks in Oracle BPM. You can use an existing Business Rule component created using the SOA Business Rule editor, or you can create a new Business Rule component using the simplified interface BPM Studio provides.
This chapter includes the following sections:
Section 16.1, "Introduction to Business Rules in Oracle BPM"
Section 16.2, "Assigning an Existing Business Rule to a Business Rule Task"
Section 16.3, "Creating a Business Rule from Oracle BPM Studio"
For detailed information about Oracle Business Rules, see Oracle Fusion Middleware User's Guide for Oracle Business Rules.
The business rule task requires you to define a Business Rule to implement it. You can use an existing Business Rule or define a new one.
If your project contains Business Rules then they automatically appear in the business catalog.
You can add new Business Rules to the business catalog in the following ways:
Using Oracle BPM
From the SOA New Gallery
From the SOA Composite Editor
The business catalog displays the Business Rules in your project in the predefined module Rules. It stores each rule in a module named as the package of the Business Rule dictionary.
Figure 16-1 shows a business rule component in the Sales Quote example.
When you double-click a business rule component in the business catalog, BPM Studio opens the SOA Business Rules editor. You can edit the Business Rule using this editor.
For information on how to define Oracle Business Rules, see Oracle Fusion Middleware User's Guide for Oracle Business Rules.
Business Rules enable you to determine the flow of your processes based on a group of rules you define.
The business rule task enables you to map the following:
Data object values to the input arguments of a business rule
The output arguments of a business rule component to data objects
When a token arrives to a business rule task, the BPMN Service Engine invokes the Business Rule Engine using the input arguments defined in the data association of the business rule task. The Business Rule engine evaluates the defined rules and returns an output containing the result. The BPMN Service Engine maps the output from the Business Rule engine to the data objects in the process using the data association defined for the business rule task.
Generally after a business rule task you add an exclusive gateway that determines the flow of the process based on the value of a data object that contains the result of running the business rule task.
Figure 16-2 shows a business rule task in the Sales Quote example process.
In the Sales Quote example, the business rule task determines the approval flow for each sales quote in the following way:
The business rule task invokes the Business Rule component providing a Quote business object as an input argument.
The Business Rule component evaluates the defined rules using the provided input.
The Business Rule component returns an ApprovalFlow business object that contains the result of evaluating the defined rules.
The business rule task data association maps the result of running the Business Rule to the approvalFlow process data object.
The exclusive gateway Is Business Practices Review Required determines the flow based on the value of the approvalFlow process data object.
You can assign existing Business Rules to a business rule task. This enables you to implement a business rule task using a Business Rule you created using the Business Rule wizard or that existed in the SOA project you used as a base for the BPM project.
To assign an existing Business Rule to a business rule task:
Right-click the Business Rule task.
Select Properties.
Click the Implementation tab.
Click the Browse... button next to the Business Rule field.
The Type dialog appears.
Select a Business Rule from the list or type the name or part of the name in the Search field to search for a Business Rule.
Click OK.
The Type dialog closes and the Business Rule field shows the Business Rule you selected.
From the Decision Function list, select a decision function.
Click OK.
The Business Rule Task Properties dialog closes and saves the implementation you selected for the Business Rule task.
The business rule task implementation uses the selected business rule component and the selected decision function.
When the BPMN Service Engine runs the business rule task, it invokes the Business Rule Engine using the input arguments defined in the business rule task data association. The Business Rule Engine evaluates the rules using the provided input argument and returns an output argument that contains the result of this evaluation.
You can create a Business Rule using the simplified interface Oracle BPM Studio provides. You can access this interface from the business rule task configuration dialog.
The simplified business rule creation interface enables you to create a Business Rule with one decision function. When you create the Business Rule you can configure the following properties:
Name of the Business Rule
Input and output
Dictionary package
Name of the decision function
After you create the Business Rule with the simplified interface you can edit it using the editor included in the SOA Suite.
To create a Business Rule from Oracle BPM Studio:
Right-click the Business Rule task.
Select Properties.
Click the Implementation tab.
Click the Add button next to the Business Rule field.
The Create Business Rule dialog appears.
In the Name field, enter a name to identify the Business Rule.
Configure the input and output of the Business Rule.
See Section 16.3.2, "How to Add Input and Output Arguments When Creating a Business Rule Component" for more information on how to configure the input and output of a Business Rule.
Optionally, configure the advanced properties of the Business Rule.
See Section 16.3.3, "How to Configure the Advanced Properties When Creating a Business Rule Component" for more information on how to configure the advanced properties of a Business Rule.
Click OK.
The Create Business Rule closes and creates the Business Rule. The Business Rule field in the Business Rules Task Properties dialog shows the Business Rule you created.
From the Decision Function list, select a decision function.
Click OK.
The Business Rule Task Properties dialog closes and saves the implementation you created for the Business Rule task.
The data objects you add as input or output arguments must use a business object based on an external type as their type.
To add input and output arguments when creating a Business Rule component:
In the Input and Output Data Objects section, click the Add button.
Select the type of argument you want to add.
The Data Object dialog appears.
Select a data object from the Data Object dialog and drag it to the table.
The input or output argument appears in the table.
To configure the advanced properties when creating a Business Rule component:
Click the Advanced tab.
In the Package field, enter the name of the package in which to store the rules dictionary.
In the Decision Function field, enter a name for the decision function that the simplified interface creates in the Business Rule component.
BPM Studio creates a Business Rule component. You can edit this Business Rule component using the SOA Business Rule editor in the same way you edit a component created using Oracle SOA Suite.
The business rule task uses the Business Rule component for its implementation.