Wednesday 30 October 2013

Using a Task Flow Template

I decided to look into the task flow features of ADF and stumbled across the template feature. Basically a task flow can extend a template and then you don't have to worry about all of the nitty gritty bits that you may have to do everytime such as auditing or setting up values etc etc.
Templates are not shown in the main designer view of taskflows...they are kind of hidden.
Below, I will show you how to complete a certain set of activities within a template and then carry on your normal taskflow operation.

So to test this, I thought I would create a template which sets up a int value and then within my main task flow, show this value.

I created a managed bean with some methods which would be called from within the template:

The template looks like the following: nothing special here apart from the big gotcha with the 'Parent Action' activity, whereby only the outcome works BUT the compiler requests you to have either a root or parent outcome. Therefore, I have just put the same action within the root.


Note: When there is no class setup for a parameter, at runtime its looking for a method with a String.

We can listen out for when the task flow template has finished its work by using the wildcard control flow rule.


Note that there is no default activity here: this is because the default has been changed to run the template


Accessing the variables within the main Task Flow is easy as everything is within the same pageFlowScope.

When running this task flow, all the templates activites get run first and then myView runs inside the region, which puts out a variable within the pageFlowScope.

Summary of notes (11.1.1.6 JDeveloper):
  • When you create a Task Flow on a template, the templates input parameters are required to call the main Task Flow.
  • If you want the template to run its children first, you need to set the default activity within the main Task Flow
  • The Parent Action requires a Root or Parent Outcome but only the Outcome is used
  • Everything within the template and Task Flow are contained within the pageFlowScope

No comments:

Post a Comment