Oracle ADF 11g is a key framework for Oracle Fusion Middleware 11g family products, same applies for Oracle BPM 11g Suite. When it comes time to application implementation on top of defined processes - its when Oracle ADF 11g comes into picture. I will present today fairly simple BPM process and will describe how we can initialize process payload with real data from database using ADF.
We can assume initial process looks like the following:
It implements two Human Tasks defined for two different roles - TeamLeaders and ProjectManagers. The logic is simple - TeamsLeaders role can initialize the task and ProjectManagers role can approve it. Download sample application for today post - EmployeeManagementLab.zip.
Process payload is initialized from Initialization activity, using dummy payload script:
I will remove this initialization script and will explain how you can initialize payload with real data from table selection:
I will retrieve initialization data from ADF BC project, you can base your Model on Web Service or EJB - no difference, ADF provides unified Data Control for different Model implementations. My ADF BC project based on HR database schema:
ADF Task Flow Human Task project for process initialization role is auto-generated from Oracle BPM 11g directly:
In this example I'm using default auto-generated ADF Task Flow for Human Task:
Auto generated ADF Faces screen for Human Task looks similar:
I have drag&dropped Panel Collection component from ADF Faces Components palette, its where Table component will be defined:
You should expand Data Controls tab to see available data collections and methods. In this example I want to create table component with Employees data, user will be able to select one Employee and enable process payload with this data:
I can create data bounded table on Employees data collection, just by drag&drop from Data Controls:
Save and Undo operations also are provided by Data Control:
Now is one of most important steps to understand - we must have attributes defined from both data collections (BPM process payload and Employees table) in Page Definition. Attributes for BPM process payload form are auto-generated, we need to define attributes that represent Employees collection by ourselves - this will allow to access currently selected row:
All attributes for Employees collection:
Every attribute is pointing to the same iterator, it brings data from ADF BC Data Control:
Next step is to override Table component selection listener, we need to process table selection event and assign payload programmatically:
Selection listener is overridden using SelectionListener table property, it should point to the Java bean method:
Java bean is created as simple Java class:
This class is declared in ADF Bounded Task Flow, same task flow where Human Task is auto-generated:
Selection listener is overridden inside Java bean class:
Inside selection listener, first we are processing table selection event. Next, using ADFUtils class helper methods, we are copying values from currently selected row into BPM process payload:
There are various approaches to copy values from one collection into another, for example you can access iterator directly and get current row, then you will need to operate with real attribute names defined in Data Control. I prefer to operate through defined Attributes, this allows to be independent from naming changes in Data Control.
Values are copied into payload, additionally we need to set Partial Trigger refresh relationship from Employees table to process payload form - to show payload changes based on different row selection:
This can be achieved both declaratively and programmatically, I will go with Java coding approach in this sample. Mainly because declarative approach will trigger refresh always, however in the future I will want to be it conditional. I need to set Binding property for payload form, this will allow to operate it from code:
Binding is defined in same Java bean, where we have selection listener:
It is enough to use defined binding from standard ADF API to send partial refresh event from table to form:
I'm running Oracle BPM 11g functionality inside WebCenter Spaces 11g through standard BPM 11g ADF Task Flows, user custom ADF Task Flows additionally are present as well - Oracle BPM/WebCenter Spaces 11g screen:
Employee assignment process is initialized from Oracle WebCenter Spaces 11g. Table data is retrieved from ADF BC, user selects row and automatically populates process payload form available on the left:
If user selects another row, payload form is updated as well:
Now we can login as another user - redsam2, who is assigned with ProjectManagers role, this role is designed to approve process and should received incoming tasks initialized with payload:
We can see several incoming tasks available:
Payload data is set correctly - task can be approved or rejected:
We can assume initial process looks like the following:
It implements two Human Tasks defined for two different roles - TeamLeaders and ProjectManagers. The logic is simple - TeamsLeaders role can initialize the task and ProjectManagers role can approve it. Download sample application for today post - EmployeeManagementLab.zip.
Process payload is initialized from Initialization activity, using dummy payload script:
I will remove this initialization script and will explain how you can initialize payload with real data from table selection:
I will retrieve initialization data from ADF BC project, you can base your Model on Web Service or EJB - no difference, ADF provides unified Data Control for different Model implementations. My ADF BC project based on HR database schema:
ADF Task Flow Human Task project for process initialization role is auto-generated from Oracle BPM 11g directly:
In this example I'm using default auto-generated ADF Task Flow for Human Task:
Auto generated ADF Faces screen for Human Task looks similar:
I have drag&dropped Panel Collection component from ADF Faces Components palette, its where Table component will be defined:
You should expand Data Controls tab to see available data collections and methods. In this example I want to create table component with Employees data, user will be able to select one Employee and enable process payload with this data:
I can create data bounded table on Employees data collection, just by drag&drop from Data Controls:
Save and Undo operations also are provided by Data Control:
Now is one of most important steps to understand - we must have attributes defined from both data collections (BPM process payload and Employees table) in Page Definition. Attributes for BPM process payload form are auto-generated, we need to define attributes that represent Employees collection by ourselves - this will allow to access currently selected row:
All attributes for Employees collection:
Every attribute is pointing to the same iterator, it brings data from ADF BC Data Control:
Next step is to override Table component selection listener, we need to process table selection event and assign payload programmatically:
Selection listener is overridden using SelectionListener table property, it should point to the Java bean method:
Java bean is created as simple Java class:
This class is declared in ADF Bounded Task Flow, same task flow where Human Task is auto-generated:
Selection listener is overridden inside Java bean class:
Inside selection listener, first we are processing table selection event. Next, using ADFUtils class helper methods, we are copying values from currently selected row into BPM process payload:
There are various approaches to copy values from one collection into another, for example you can access iterator directly and get current row, then you will need to operate with real attribute names defined in Data Control. I prefer to operate through defined Attributes, this allows to be independent from naming changes in Data Control.
Values are copied into payload, additionally we need to set Partial Trigger refresh relationship from Employees table to process payload form - to show payload changes based on different row selection:
This can be achieved both declaratively and programmatically, I will go with Java coding approach in this sample. Mainly because declarative approach will trigger refresh always, however in the future I will want to be it conditional. I need to set Binding property for payload form, this will allow to operate it from code:
Binding is defined in same Java bean, where we have selection listener:
It is enough to use defined binding from standard ADF API to send partial refresh event from table to form:
I'm running Oracle BPM 11g functionality inside WebCenter Spaces 11g through standard BPM 11g ADF Task Flows, user custom ADF Task Flows additionally are present as well - Oracle BPM/WebCenter Spaces 11g screen:
Employee assignment process is initialized from Oracle WebCenter Spaces 11g. Table data is retrieved from ADF BC, user selects row and automatically populates process payload form available on the left:
If user selects another row, payload form is updated as well:
Now we can login as another user - redsam2, who is assigned with ProjectManagers role, this role is designed to approve process and should received incoming tasks initialized with payload:
We can see several incoming tasks available:
Payload data is set correctly - task can be approved or rejected: