How to Retrieve BPM Roles from the ADF Application

This blog shows you how you can query BPM roles from the ADF application.

Assumption is that you have created a BPM project, defined a process with an interactive User Task with Human Task as an initiator. Once you have defined Human Task, you can now right click on the User Task in the process designer and Launch Task Form Wizard to create bounded ADF Task Flow based on above defined MyRoleHumantask.
Task Form

For simplicity, we will utilize recently created task form and add the code to pull roles from BPM. Create and register RolesManangedBean in your MyRoleHumantask_TaskFlow. The RolesManangedBean has code to query list of user’s role.

    public String[] getAllRoles(){
        return ADFContext.getCurrent().getSecurityContext().getUserRoles();

Empty Task Form

Add ADF table in your Task Form to display roles and deploy the FaBPM application.
Roles Table
Roles Table Code

The Challenge

Login to your workspace, click TestRolesProcess application and see what it retrieves. Surprisingly, the roles shown in the table of my ADF application does not contain the BPM roles that I am assigned to. For e.g. sanjib has only roles defined in Weblogic security realm and none from BPM roles association.

Roles shown in workspace:
Roles Shown in Workspace

Roles in ADF Application:
ADF App with only WLS Roles

The Fix

How do we fix this? Fix could not be any simpler, just add following init-param under JspFilter in web.xml. And make sure you have BC4J Security library in the classpath of your view project.


web.xml file

Deploy the application again. Voila! Now you also see roles from BPM being retrieved for the logged in user.
ADF App with All Roles

Newest Most Voted
Inline Feedbacks
View all comments

I new in this, and i don’t have idea about how create RoleManangedBean, can you helpme?


You can create a java class called RoleManagedBean and add it to the ADF task flow using page flow scope. Then implement the method shown in the example “getAllRoles()”