Wednesday, April 6, 2011

Programmatically Accessing ADF Task Flow List

Based on different scenarios, you may need to implement solution to access ADF Task Flow list available inside ADF application. These scenarios can be really different, for example you may construct UI Shell menu based on available ADF Task Flows or simply present list of available ADF Task Flows to the user. I will describe in this blog, how with OPSS (Oracle Platform Security Services) API to list all ADF Task Flows declared in ADF Security store.

Download sample application - This application is enabled with ADF Security, it contains three ADF Task Flows granted with security role:

Its really sufficient to retrieve only ADF Task Flows declared in ADF Security store, because ADF Task Flows without assigned security role will not be visible anyway.

Very important to know, in order to be able to access ADF Security store with OPSS API programmatically, you need to grant special security permission - PolicyStoreAccessPermission to the user. Sample application contains this permission, check in jazn-data.xml:

Core method is implemented inside TaskFlowList class, this method is using OPSS API to access application policy store, get all grant entries and iterate over all permission entries per each grant. If permission class is equal to TaskFlowPermission, ADF Task Flow address is retrieved and added to the collection:

This example is based on POJO Data Control with data collection variable - taskFlow of type ArrayList, it is populated with all retrieved ADF Task Flow addresses:

I'm exposing data collection by generating POJO Data Control:

Data collection becomes available from Data Control, you can drag and drop it on ADF page:

Run sample application and login as user redsam/welcome1:

All ADF Task Flows declared inside current ADF application are listed in the table:

No comments: