Tuesday, March 16, 2010

Oracle ADF Task Flow in a Nutshell

The concept of unbounded and bounded task flows is new to JavaServer Faces (JSF) and is an extension exclusively available to Fusion web application developers who use the ADF Controller, which extends the JSF navigation model, for their application flow handling.

In this article, we will describe what a task flow is and compare unbounded task flows with bounded task flows.

ADF Task Flow

ADF task flows provide a modular approach for defining control flow in an application. Instead of representing an application as a single large JSF page flow, you can break it up into a collection of reusable task flows. Each task flow contains a portion of the application's navigational graph. The nodes in the task flows are activities. There are two types of activities: visual vs. non-visual. The transitions between the activities are called control flow cases.

Because only pages and page fragments are displayed in a browser, ADF Controller continues any navigation to non-visual activities until a visual activity is reached. This turns non-visual activities into intermediary actions that are performed on the navigation path between two views.

Task flows don't own the pages they reference. All ADF Faces pages are located in the web project HTML root directory or a subdirectory of it. Independent of whether or not a page is referenced in a bounded or unbounded task flow, or both, it is always directory accessible from the browser URL field. Developers should be aware of this and implement a protection strategy, such as one through ADF security, that prevents users from directly accessing pages that they are not authorized to access.

At design time, developers need to consider the following issues with task flows:
  • Whether to use a shared data control frame or its own, isolated data control frame (this creates a new application module connection). Note that a data control frame is the container associated with a task flow that contains data control instances.
  • Whether a new transaction is to be begun or not
  • Whether a task flow should allow reentry or not
  • Whether an unbounded task flow or a bounded task flow should be used

Bounded Task Flow

Bounded task flow represents modular and reusable application flows with a defined entry (i.e., default activity) and zero to many defined exit points (i.e., task flow return activities). They can be called from other task flows, referenced from a browser URL or embedded as a region in a view (see Andrejus Baranovskis' article for an example). They support reuse, parameters, transaction management and reentry.

In addition, bounded task flows have the following features:
  • Operate within their own private memory scope--page flow scope
  • Are loaded lazily at runtime
  • A new instance of TaskFlowContext (can be accessed using EL ${controllerContext.currentViewPort.taskFlowContext}) will be created each time a bounded ADF flow is entered. This context:
    • Manages the lifespan of all DataControl instances within the bounded task flow
    • Holds the information about the task flow ID and whether or not it contains uncommitted data
  • Don't support multiple transactions when sharing the data control frame with parent flow
  • To call a bounded task flow directly from a URL, the default activity must be a view activity
  • Can be set to be critical (i.e., dictates the framework to create an implicit save point when entering a bounded task flow. Also helps to prevent users from closing the browser window or browser tab if uncommitted data is present).
  • If protected by ADF Security, authorization is checked first.
  • You can create train-based activities in a bounded task flow and only one train is allowed in each.
Bounded task flow should be used if it:
  • Should be reused in same or other applications
  • Should run as part of a page within a region container
  • Requires an isolated transaction context
  • Changes data and then either commits or rollbacks on exit
  • Has a requirement for a single entry point

Unbounded Task Flow

A Fusion web application always contains an ADF unbounded task flow, which contains the entry point or points to the application. Its XML configuration file (i.e., adfc-config.xml) is automatically created when building a new application using the Fusion Web Application (ADF) application template or when adding the ADF Page Flow Technology Scope to an existing or new web project. There will always exist a single instance of unbounded task flow at runtime, even if there is no activity added to it.

A unbounded task flow has the following features:
  • You cannot declaratively specify input parameters for it.
  • It cannot contain a default activity (i.e., an activity designated as the first to run in the task flow). This is because an unbounded task flow does not have a single point of entry.
  • It can be configured by one or many configuration files that are parsed and loaded the first time the user starts the application.
  • View activities of an unbounded task flow can be configured bookmarkable
  • Managed beans that are in session or application scope should be configured in the unbounded task flow definition.
  • You cannot create a train from activities in an unbounded task flow.
  • You cannot use a task flow template as the basis for creating a new unbounded task flow

You typically use an unbounded instead of a bounded task flow if:
  • You want to take advantage of ADF Controller features not offered by bounded task flows, such as bookmarkable view activities.
  • The task flow will not be called by another task flow.
  • The application has multiple points of entry. The task flow can be entered through any of the pages represented by the view activity icons on the unbounded task flows.
  • You want to bookmark more than one activity on the task flow.
  • For application flows that are not restrictive on where a user enters the flow.

Read More...

  1. Oracle Fusion Middleware Online Documentation Library 11g Release (11.1.1.2)
  2. Oracle Fusion Developer Guide by Frank Nimphius and Lynn Munsinger
  3. Oracle ADF Controller
  4. Open Source sample applications for Oracle Fusion Middleware technology
  5. ADF Task Flow in JDeveloper 11g

3 comments:

Unknown said...
This comment has been removed by the author.
Unknown said...

The task flow info is useful stanley. The bounded and unbounded task flow descriptions are very clear now. Thanks.

upgrade sap 6.0

KITS Technologies said...

Major thanks for the post.Really thank you! Will read on…
python online training
python training