Saturday, June 1, 2013

Payload Or Database ?



(JDeveloper 11.1.1.7, WLS 10.3.6, SOA/BPM 11.1.1.7)

Not all data can be stored, or is recommended to be stored in the Payload. Especially the Transactional or Relational data. They are as usual should be stored in the Database.

So let us assume that we keep the Transactional and Relational data in the Database.
We still need to keep some data in the Payload for the process to function properly.
We keep only that data in the Payload that will affect the flow in the Process.
During the progress of the Process we might have to change some Payload values which will affect the flow of the process.

BPM might not know about the data we store in the Database. Most of the cases it will be Custom data. So it is our responsibility to maintain an association between the Process and the custom data in the database.

In this post, I would like to show a logic which can maintain a relation between the custom data and the process.

Either the unique process instance id can be stored in our database table (most cases it will be the main entity of the application), or put the main entity's primary key in the Payload.
I would recommend the first option, put the process instance id in the main entity database table.


The use case I assumed for this is a BPM process of book requests for employees.
Following is the database table I created for holding the book requests information.




Created a simple process as follows for the book request



Created a UI project for BPM Human Tasks as follows


Create another ADF Model Project in the same application and create the necessary BC4J objects based on the UI requirements.




Create another ADF View Controller project in the same application and create a bounded task flow in the common UI project





Create a task flow parameter for the bounded task flow to get the bpm process instance Id.




Create the Book Request form from the data controls in the page




Add a View Criteria to the VO as follows




Add a method to the AM as follows 




And Create a client interface for that method


Add the method to the task flow as follows by passing the parameter from the page flow scope and make it the default activity.



Open the common UI project deployment profile and create an ADF Library JAR file


Create the jar library file


Create a new file system connection to the deploy folder of the common UI project



Select the BPM UI project and add the library to the project



It should show like below if it is added successfully


Create a binding on the BookRequest page for process instance id from the data control for RequestBook task as follows. You can hide this if you want. It is not necessary to show it to the user.


Drag and drop the taskflow from library as region to the BookRequest page in the BPM UI project as follows



Pass the instance id from the page binding as follows as parameter to the taskflow region



Do the same for ReviewBook and ResponseBook pages

Also, we have to add Commit binding to all the 3 pages. This should be called programmatically on Submit button. (Not shown in this post)



Deploy the application and test.

Login as Employee and create a book request and Submit. (We have to save manually here first. – Should actually call the commit binding on Submit button code)


The Manager will get a task for reviewing the book request.

Here the book request region is same from the library and is fetching the data from the database using the bpm process instance id.



Please look at my previous post for detail steps to create a BPM process.

No comments:

Post a Comment