• ADF
    December 15, 2010

How to set conditional activation to taskflows?

This article describes implementing conditional activation to taskflows.

Use Case Description

Suppose we have a taskflow dropped as region on a page &
this region is enclosed in a popup .By default when the page is loaded
the respective region also gets loaded.Hence a region model needs to
provide a viewId whenever one is requested. 

consequence of this is the TaskFlowRegionModel always has to initialize
its task flow and execute the task flow's default activity in order to
determine a viewId, even if the region is not visible on the page.This can lead to unnecessary performance overhead
of executing task flow to generate viewIds for regions that are never

In order to increase the performance,we need to set the
taskflow bindings activation property to 'conditional'.Below described
is a simple usecase that shows how exactly we can set the conditional
activations to taskflow bindings.


1.Create an ADF Fusion web Application

2.Create Business components for Emp table

3.Create a view criteria where deptno=:some_bind_variable

4.Generate EmpViewImpl.java file & write the below code.Then expose this to client interface.

    public void filterEmpRecords(Number deptNo)
       // Code to filter the deptnos

        ensureVariableManager().setVariableValue("some_bind_variable",  deptNo);

5.Create an ADF Taskflow with page fragements & drop the above method on the taskflow

drop the view activity(showEmp.jsff) .Define control flow case from the
above method activity to the view activity.Set the method activity as
default activity


7.Create  main.jspx page & drop the above taskflow as region on this page


8.Surround the region with the dialog & surround the dialog with the popup(id is Popup1)

9.Drop the commandButton on the above page & insert af:showPopupBehavior inside the commandButton:

<af:commandButton text="show popup" id="cb1">
<af:showPopupBehavior popupId="::Popup1"/>

if we execute this main page ,we will notice that the method action
gets called even before the popup is launched.We can avoid this this by
setting the activation property of the taskflow to conditional

the bindings of the above main page & select the taskflow binding
,set its activation property to 'conditional' & active property to
Boolean value #{Somebean.popupVisible}.
By default its value should be false.


need to set the above Boolean value to true only when the popup is
launched.This can be achieved by inserting setPropertyListener inside
the popup:

<af:setPropertyListener from="true" to="#{Somebean.popupVisible}" type="popupFetch"/>

if we run the page,we will notice that the method action is not called
& only when we click on 'show popup' button the method action gets

Join the discussion

Comments ( 1 )
  • guest Thursday, February 23, 2012


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.