How to set conditional activation to taskflows?
Posted
by shantala.sankeshwar(at)oracle.com
on Oracle Blogs
See other posts from Oracle Blogs
or by shantala.sankeshwar(at)oracle.com
Published on Wed, 15 Dec 2010 14:42:17 +0530
Indexed on
2010/12/16
4:14 UTC
Read the original article
Hit count: 598
adf
|BC4J
|Faces
|ADF Faces
|Business Components
|jdeveloper
|Oracle
|Taskflow Conditional acti
|View criteria
|page fragements
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.
A 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 visible.
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.
Steps:
1.Create an ADF Fusion web Application
2.Create Business components for Emp table
View image
3.Create a view criteria where deptno=:some_bind_variable
View image
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);
this.applyViewCriteria(this.getViewCriteria("EmpViewCriteria"));
this.executeQuery();
}
5.Create an ADF Taskflow with page fragements & drop the above method on the taskflow
6.Also 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
View image
7.Create main.jspx page & drop the above taskflow as region on this page
View image
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"/>
</af:commandButton>
10.Now 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
11.Goto 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.
View image
12.We 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"/>
13.Now 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 called.
© Oracle Blogs or respective owner