Sunday, September 29, 2013

Conditional Task Flow Activation in ADF 12c/11g

I will talk about tabs and ADF regions. Depending on the use case, you may want to ensure always only one region is loaded - the one which is displayed. If user opens another tab - region from previously open tab should be destroyed. We can achieve such functionality with combination of conditional region activation and ADF task flow isolated scope. Every time when different tab will be opened - ADF will open referenced region as the first time, data will not be cached.

Feel free to download sample application this post is based on - The key part is to enable conditional activation for every region included into tabs, see here example based on EL:

Every tab must have property listener defined to set tab identifier, the same is used from Page Definition EL to conditionally activate currently displayed region:

Region will be deactivated successfully, only if Isolated data control scope is set. Make sure Isolated scope is set for every region:

Deactivated region custom resources should be cleaned through finalizer, Page Flow Scope is cleaned along with Data Control entry, and AM instance - automatically:

Let's open one of the tabs from the sample for the first time - Employees:

Employees data is fetched from DB initially:

Go to the first tab - Departments and then open Employees tab again:

You will notice Employees data fetched again, as region was created from scratch, as it was destroyed before:

This approach could work as optimization for some of the use cases, when you don't want to hold data for the long time, when user is not working with the region from inactive tab.


Alekhya Rao said...

Andrejus, Thanks a lot for the post. I am a newbie to ADF,and have a question on this.

How do we deactivate if we use Jdev 11 version ( as there is no Isolated Scope. Does the taskflow run in the background. If yes, how to handle.

marlon said...

Hi Andrejus.

My question is about performance. What if I don't want to desactive the tab while this is open because user may leave pending task in one tab and go to another maybe to check somethig and return.

I can see that this use of case means a new session (connection?) for tab. Is this recommended? Is there a big poolsize restriction? Or should I leave active only the current tab for better performance?

If I check number of sessions on v$session table I see one per open tab. Is there a problem if another user enter to the application and the number of session or records on v$session table are the same of connection pool size?

I'm a rookie in perfomance issues and I have many questions in my head but I have not had good answers searching in google, so I would appreciate at least any light on this.

Thank you in advance Andrejus.

Andrejus Baranovskis said...


Then you should use default Shared scope for the TF.