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.

1 comment:

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.