This sample demonstrates creation of a custom function in
Oracle Business Rules, using it in the RuleSet and calling it form a BPEL
Process
High-level details
This example involves the following
a.
Implementation of a custom function in Oracle Business
Rule
This is a simple function that adds the
input date by 1 day and returns. This function will be further enhanced in
later examples by extending the logic.
b.
Calling the custom function from the Business
Rule If-Else Decision Service
c.
Calling the Business Rule from BPEL
Implementation
·
Create a schema for the input and output
·
Create a SOA Process with a BPEL Process using
these input and output
·
Create a new Business Rule Component in the same
component using the same input and output. In this example, since the usage of
BPEL process is just to call the Business Rule, the schema elements are same
but these could be any depending on your business requirement.
·
Business Rule Implementation
a.
Creating Globals - for constants
a
a.
Creating Function
First, define the signature of the function
Click on the '+' icon, give the name of the function, returnType, and
description
In
the Arguments section, define the input arguments of this function
You'll
see a warning as the function is not implemented yet
Pseudo Code for the function
Initialize the variables
Convert the input string into
XMLGeorgianCalendar format (This has many date related functions, so used this
type)
Add
1 day to this converted date
Convert the resulting value to String and return
a.
Defining Ruleset
This
is a simple ruleset to call the just defined function
The final Ruleset looks like this
Now that the Business Rule is implemented
successfully, the only thing left is to use this in the BPEL Process
·
Using the Business Rule inside BPEL Process
Inside BPEL, drag and drop the Business
Rule component from the SOA Components section in the Resource Pallette
Input & Output Association in BPEL
Your final BPEL Process should look like this