Aug 6, 2012

Basic of taskflow

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.It means if we want to navigate from one page to another.

In simple words,task flow is visual representation of application process flow.Each Task Flow contains portion of application navigation.They are similar to traditional flow charts and its primary purpose is reuse.


Some features of  Task Flow:-

  • The application can be broken up into a series of modular flows that call one another.
  • You can add to the task flow diagram nodes such as views, method calls, and calls to other task flows.
  • Navigation is between pages as well as other activities, including routers.
  • Shared memory scope (for example, page flow scope) enables data to be passed between activities within the task flow. Page flow scope defines a unique storage area for each instance of an ADF bounded task flow.
  • ADF task flows are reusable within the same or an entirely different application. After you break up your application into task flows, you may decide to reuse task flows containing common functionality.
     
Types of task flow:-

The two types of ADF task flow are:
  • Unbounded task flow: A set of activities, control flow rules, and managed beans that interact to allow a user to complete a task. An ADF unbounded task flow consists of all activities and control flows in an application that are not included within any bounded task flow.
    A Fusion web application always contains an ADF unbounded task flow, which contains the entry point or points to the application.
    This task flow contains a number of view activities that are all entry points to the application.

    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.
    • 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.Pages are associated with view activities. The icon for a view activity displays a page image like this:
      Page image in view activity icon
    •  An unbounded task flow cannot declaratively specify parameters. In addition, it cannot contain a default activity, an activity designated as the first to run in the unbounded task flow. This is because an unbounded task flow does not have a single point of entry. To perform any of these requires an ADF bounded task flow.

  • Bounded task flow: A specialized form of task flow that, in contrast to an unbounded task flow, has a single entry point and zero or more exit points. It contains its own set of private control flow rules, activities, and managed beans. An ADF bounded task flow allows reuse, parameters, transaction management, and reentry.
    A bounded task flow is also known as a task flow definition. By default, JDeveloper proposes the following filename for the source file of a bounded task flow:
    task-flow-definitionN.xml
    where N is a number that increments each time that you create a new bounded task flow.
    The file contains the metadata for the bounded task flow. Multiple task flow definitions (bounded task flows) can be included within the same task flow definition file.

    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 instance).

    An unbounded task flow can call an ADF bounded task flow, but cannot be called by another task flow. A bounded task flow can call another bounded task flow, which can call another and so on. There is no limit to the depth of the calls.


    A typical application contains one unbounded task flow and many bounded task flows.
    Build bounded task flows in its own application/workspace.
 Bounded Task flows can:- 
  •    Create with Pages or Page fragments.
  •    Create as Train flows.
  •    Call in a Dialog.

ADF Bounded Task Flow Features:-

Feature   Description
Well-defined          boundary 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 of such things as page names, method calls, child bounded task flows, managed beans, and control flow rules within the bounded task flow boundary. 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.


Page flow memory scope You can specify page flow scope as the memory scope for passing data between activities within the ADF bounded task flow. Page flow 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.

Addressable 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.

Reuse You can identify an entire group of activities as a single entity, an ADF bounded task flow, and reuse the bounded task flow in another application within an ADF region. For example, the Hot Items and Start Shopping tabs on the home page of the Fusion Order Demo application reuse the same task flow embedded in a region. Different parameters are passed to each region to determine the lists of products that display.
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.

Transaction management An ADF bounded task flow can represent a transactional unit of work. You can declaratively specify options on the bounded task flow 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.

Reentry You can specify options on the bounded task flow that determine whether or not it can be reentered.

On-demand loading of metadata ADF bounded task flow metadata is loaded on demand when entering an ADF bounded task flow.

Security You can secure an ADF bounded task flow by defining the privileges that are required for someone to use it.



 A typical application is a combination of an unbounded and one or more bounded task flows. For example, JDeveloper, by default, creates an empty unbounded task flow (source file name is adfc-config.xml) when you create a Fusion web application using the Fusion Web Application template. At runtime, the Fusion web application can call bounded task flows from activities that you added to this unbounded task flow.





Page vs Page Fragment :-

Page Fragment :-
Renders as content in another JSF page 
Must not contains the af:document ,af:form ,f:view, head, body and html because JSF page already has it.
has .jsff extensio

 Page:-
can contains many fragments.
extension .jsf or .jspx

Task flow Regions:- 

Regions are created when you drag and drop a bounded task flow on a page.


Task Flow Managed Bean Scopes :-



Task Flow Components :-




















Note:-  Task flow name and page name should be unique for a project.