Thursday, August 30, 2012

Generic ADF 11g Human Task Handler Concept for Oracle BPM

One of the main complexities with Oracle BPM - how to organize Human Task projects and components. Is preferable to avoid code duplication and having lots of generated ADF Data Control files in different ADF UI projects. Reusability problem can be solved by having generic Human Task handler - I will describe its concept in this blog.

One of the main principles defined in this post - pass through BPM payload only key attributes. Key attribute should identify business object in the process, but associated data for this business object always will be queried from database. This allows to implement reusable ADF UI for Human Tasks and avoid data transformation complexity in BPM. Of course this approach will work, if you will be granted access to the data.

Concept is tested and implemented as sample application, available for download - This application implements BPM process with two Human Tasks, but there is only one ADF UI project (it serves both Human Tasks):

Human Task activities available in BPM process:

Now if you want to generate ADF UI for these Human Tasks - stop, wait a bit. Instead of generating separate ADF UI for each of these Human Task activities - create another dummy Human Task activity and we generate generic ADF UI from it. This generic Human Task should be configured with all required actions for any Human Task from the process:

Dummy Human Task is defined - GenericHumanTask:

We generate GenericHumanTaskUI project from this dummy Human Task:

Once ADF UI project was generated - delete dummy Human Task, we don't need it anymore. Change generated ADF Task Flow - add Router activity. Router decides to open page directly or set current row first (suppose first Human Task shows list of employees and second Human Task needs to display only one specific employee):

ADF UI Generic Human Task application is enabled with ADF Security, it defines application role to differentiate users from Router activity in the Task Flow - task-creator-role, this role is granted to the user who have access to the first Human Task - Assign Employee:

ADF Task Flow Router activity checks application security role granted to the user and navigates accordingly:

If flow goes through the method, where current row is set - key value is retrieved from BPM payload variable:

There is only one ADF UI page, it serves both Human Tasks:

Data is rendered conditionally for each of the tasks. First Human Task displays editable data and second - readonly. This is controlled on ADF BC EO level with ADF Security. Employees EO is enabled with Update security operation:

Update permission is granted to the task-creator-role, the same role which is allowed to open ADF UI page directly. This means user granted with such role will be able to change data:

Remember we exposed all operations for generic Human Task, now we can see all these operations available in Data Control:

ADF UI page for the Human Task is auto generated to support all these operations. Based on condition and Human Task configuration, ADF will render only available operations for specific Human Task. This is how we can maintain generic Human Task ADF UI for different BPM Human Task definitions:

Generic ADF UI is deployed as separate application:

The trick is to point both Human Task instances to the same ADF UI - ADF Task Flow.

AssignEmployee task points to EmployeeGenericHumanTaskUI:

ApproveEmployee task points to EmployeeGenericHumanTaskUI:

Test ADF UI with user - redsam1, this user have access to AssignEmployee task:

This user gets editable access, can select Employee data and send for further for processing:

Submit task:

Login as another user, who have access to the ApproveEmployee task:

Task data is rendered in readonly mode and only row based on submitted key from BPM process. Task actions are also different from previous Human Task:


Ritu Singh said...

Great Post!!!...Very Simple example to explain the mammoth task...I wasn't just able to achieve this since I only work BPM and not ADF...

Thanks a ton...

Andrej Baranovskij said...

This is my purpose - to make complex things simple. Thanks a lot for feedback :-)


!!! said...

Hi Andrejus that was very useful article , I have a question for you regarding BPM but I couldn't find any article that would guide me to it, I posted on oracle forum with no luck and I hoped that you would have a clue on what approach to take.
I have a webservice method that one of its arguments a list of strings , now if this list has one value only the process works fine , but if it contains two or more values it give me the following error

XPath query string returns multiple nodes. The assign activity part and query bpmn:getDataObject('InspectBO')/ns:fileName are returning multiple nodes. The assign activity part and query named in the error message returned multiple nodes. It should return single node.

now here is the part of the process that fails



so this part bpmn:getDataInput('initiateInspectionProcess')/documentsNamesList refuses to accept more than one value at a time , even if the data association shows it as a list of strings : String[] : documentsNamesList[]

the initiateInspectionProcess is coming from the signature of the webmethod ,I am using Jdeveloper

Upreti said...

Great post! . But couldn't see second picture.

Andrej Baranovskij said...

I can see it - probably Google issues on your side.


Anonymous said...

You just need to click on the image and it will enlarge and stays in focus.

Mozika said...

hi Andrejus,
thanks for this procedure
I'm a beginner, I have a question:
when you say : "The trick is to point both Human Task instances to the same ADF UI - ADF Task Flow." we have to do it in EM ?
this association between HTinstance and UI made manually in EM will be overwritten by the next deployment ?

thanks for your reply,

Anonymous said...

Hi Andrejus, I see the download link is broken, can you upload a new version of 12C if possible.

Anil Nagandla

Andrej Baranovskij said...

Refer to: