Thursday, November 25, 2010

Navigation Between ADF Task Flow Template and Consuming ADF Task Flow

ADF task flow can be based on ADF task flow template by reference or by copy. If we base it by copy, this means template contents will be copied directly into consuming ADF task flow. All subsequent changes happening inside template, will not be propagated to consuming ADF task flow. In the opposite, when ADF task flow is using template by reference - all template changes will be reflected in consuming ADF task flow. I would recommend to follow template by reference option, however you need to understand few tricks with this approach. Today I will describe how to invoke navigation between ADF task flow template activity and custom activity from consuming ADF task flow.

Download sample application - TaskFlowTemplate.zip. When working with ADF task flow templates, first you should create ADF task flow template itself:


Template contents can be defined later, initially you can create ADF task flow based on that template by reference:


Specify Base on Template option and choose to update when ADF task flow template is changing - by reference:


Now we can define ADF task flow template contents. We will have one simple fragment activity for Jobs data. There is also one global activity, it points to Jobs fragment and defines details outcome. One important thing you must understand, is that we will override this outcome later inside consuming ADF task flow and will be able to point to custom fragment:


Jobs fragment from ADF task flow template contains Details button. This button is supposed to navigate based on details outcome:


It is using details outcome as navigation action:



Consuming ADF task flow, which is based on ADF task flow template is overriding details outcome name and point to employeesDetail fragment. This allows to navigate from ADF task flow template fragment to fragment defined directly inside consuming ADF task flow:


Fragment from consuming ADF task flow, brings Employees data based on currently selected Job - Master/Detail:


One more trick - we want to navigate back from Detail fragment to Master, this means we need to have navigation back to ADF task flow template fragment. Jobs button:


We will follow the same approach, and will define one more global navigation inside ADF task flow template - jobs. This navigation will not be overridden in consuming ADF task flow:


Jobs button from consuming ADF task flow fragment should use jobs outcome for navigation action:


Jobs fragment from ADF task flow template displays FI_ACCOUNT job data:


User can press Details button - it will execute overridden navigation and bring Employees fragment from consuming ADF task flow:


We can navigate back by pressing Jobs button, it will return to ADF task flow template fragment:

No comments: