By W.ZH, Jan 2009 abstract from Fusion ADF 11g dev guide
Task flow is an important new concept in the ADF 11g, especially the bounded task flow. So this article is to summarize the bounded taskflow for the new beginners.
An ADF bounded task flow is used to encapsulate a reusable portion of an application. A bounded task flow is similar to a Java method in that it:
■ Has a single entry point
■ May accept input parameters
■ May generate return values
■ Has its own collection of activities and control flow rules
■ Has its own memory scope and managed bean lifespan (a page flow scope
An ADF bounded task flow consists of its own set of private control flow rules, activities, and managed beans. A caller requires no internal knowledge about them. Input parameters can be passed into the bounded task flow, and output parameters can be passed out on exit of the bounded task flow. Data controls can be shared between task flows.
Single point of entry
An ADF bounded task flow has a single point of entry, a default activity that executes before all other activities in the task flow.
pageFlow memory scope
You can specify pageFlow as the memory scope for passing data between activities within the ADF bounded task flow. pageFlow scope defines a unique storage area for each instance of an ADF bounded task flow. Its lifespan is the ADF bounded task flow, which is longer than request scope and shorter than session scope.
You can access an ADF bounded task flow by specifying its unique identifier within the XML source file for the bounded task flow and the file name of the XML source file.
You can identify an entire group of activities as a single entity, an ADF bounded task flow, and reuse the bounded task flow
You can also reuse an existing bounded task flow simply by calling it. For example, one task flow can call another bounded task flow using a task flow call activity or a URL.
In addition, you can use task flow templates to capture common behaviors for reuse across different ADF bounded task flows.
Parameters and return values
A caller can pass input parameters to an ADF bounded task flow and accept return values from it. In addition, you can share data controls between bounded task flows.
An ADF bounded task flow can represent a transactional unit of work. You can declaratively specify options on the task flow definition that determine whether, when entering the task flow, the task flow creates a new transaction, joins an existing one or is not part of the existing transaction.
You can specify options on the task flow definition that determine whether or not the ADF bounded task flow can be reentered. For more information.
All memory scopes are supported for managed beans in adfc-config.xml. ADF
bounded task flows allow managed bean scopes of application, session, request,
pageFlow, or none.
In order to allow managed bean customizations in an ADF bounded task flow, ensure
the managed bean metadata resides in the task flow definition for the ADF bounded
task flow. Avoid placing managed beans within the faces-config.xml file.
When an ADF bounded task flow executes, faces-config.xml is first checked for
managed bean definitions, then the task flow definition file for the currently executing
task flow is checked. If no match is found in either location and the managed bean is in
session or application scope, adfc-config.xml and other bootstrap XML source
files are checked.
Lookup precedence is based on memory scope. request scope managed beans take
precedence over session scope managed beans.
Each ADF bounded and unbounded task flow exists inside a page flow scope that is
independent of the memory scope for all other task flows. Page flow scope is not a
single state like session scope. It defines a unique storage area for each instance of an
ADF bounded task flow. Each instance of the called ADF bounded task flow has its
own state. An ADF bounded task flow may therefore be called recursively.
Page flow scope is recommended as a means for passing data values between activities
within a task flow. Application and session scopes are also allowed within task flow
definition files, but are not recommended. Avoid using application and session scope variables because they can
persist in memory beyond the life of the ADF task flow. This may compromise the encapsulation and reusable aspects of a task flow.
■ Avoid using session scope to pass values from one ADF task flow to another. Better use page flow scope variables within the ADF task flow,
and use parameters to pass values between task flows.
■ Use view scope for variables that are needed only within the current view activity and not across view activities.
■ Use request scope when the scope does not need to persist longer than the current request.
■ Use backing bean scope managed beans in your task flow if there is a possibility that your task flow will appear in two region components on the same page and you would like to isolate region instances.
As a rule, use the narrowest scope that will work.
When one task flow calls another task flow (Could be in another remote application.), the calling task flow cannot access the called task
flow’s page flow scope and vice versa.
You can drop its task flow definition from the Application Navigator onto a JSF page:
■ If the bounded task flow contains view activities that are page fragments, it is
added to the JSF page as an ADF region.
(This means all activities of this task flow will happen within this caller’s page.)
■ If the bounded task flow contains view activities that are pages, you have the
option of adding a button or link to the JSF page. When clicked, the button or link
executes the bounded task flow.
(This means when user click this button, browser will guide the user to a new page belong to the page flow.)
You can convert existing activities, JSF page flows, and JSF pages into new ADF
Controller components such as ADF bounded task flows and task flow templates.
You can create a new ADF bounded task flow based on selected pages in a JSF page
flow. Only pages that are part of a flow (that is, those that are linked by JSF navigation
cases) are converted to view activities in the new task flow.
You can convert an existing ADF bounded task flow to an unbounded task flow or
change whether the views it contains are pages or page fragments.
A task flow = activities ( Method Call, Router, Task Flow Call, Task Flow Return,
Save Point Restore, URL View, View-JSP or fragment)
+ control flow cases ( Control Flow Case, Wildcard Control Flow Rule )
Task flow call activity before and after listeners are used to identify the start and end
of an ADF bounded task flow. Specifying a listener in the task flow call activity means
that the listener executes on that specific usage of the called task flow definition.
The task flow return activity identifies the point in the application control flow where
an ADF bounded task flow completes and sends control flow back to the caller. You
can use the task flow return activity only within an ADF bounded task flow.
The ADF bounded task flow can optionally return a value to the calling page when the
modal dialog is dismissed. The return value can be displayed in an input UI
component on the calling page.
The launching command button must specify a return listener. The return listener is a
method binding for a method with one argument, a return event. The return listener
takes the value specified in the returnEvent and sets it on the input component.
The input UI component should accept the return value of the command button by
specifying a backing bean and setting its partialTriggers attribute to the id of the
launching command button (see Using Input Components and Defining Forms in the
Oracle Fusion Middleware Web User Interface Developer’s Guide for Oracle Application
Development Framework for more information). The backing bean containing the return
listener should be registered in adfc-config.xml.
The target bounded task flow in the example contains a single view activity associated
with a page that contains an output text component. The source task flow passes the
value in the input text field as a parameter to the target task flow (for more
information, see Section 15.2, “Passing Parameters to an ADF Bounded Task Flow”).
In addition, the target task flow should specify a return value definition. To return a
value, you must specify:
■ Return value definition on the called bounded task flow. This specifies where the
return value is to be taken from upon exit of the called bounded task flow.
■ Return values on the task flow call activity in the calling task flow. These specify
where the calling task flow can find return values (for more information, see
Section 15.4, “Specifying Return Values”).