Leveraging Oracle Workflow for Declarative PageFlow
By Vijay Shanmugam-Oracle on Aug 03, 2010
This blog post contributed by Dilbagh Singh.
Oracle Workflow can be leveraged in Oracle Applications Framework for designing declarative Page Flow, which is used to handle conditional navigation rules.This is a better way to handle page navigations if you would want to avoid static, complex logic in the page controllers to handle different navigation scenarios. This requires a user to create a Pageflow workflow definition which is associated with the OA Framework based pages. Then there are certain APIs which are used in transition flow of the workflow. I would like to focus on creating a Workflow Definition for the page flow and how to interact with it as the transaction proceeds.
1. Create the OA Framework pages
Create the OA Framework pages you would want the page flow to consist of.
2. Design the Workflow Definition for the Page Flow
Define the Workflow in the workflow builder following the below mentioned guidelines:
- Add a function activity for each page in the transaction. For each activity, decide whether to:
- Associate the result with this activity (for conditional navigation) OR
- Explicitly mark the activity as blocked by associating a Blocking Function (wf_standard.block), a PLSQL function with it
- When the Workflow Engine encounters a blocking activity it stops and waits for some sub-process or external entity to provide the information it needs to proceed. So, with the mapping between transaction pages and the blocking activities in the Workflow, you can query the activity data to find out what page ought to be rendered.
- Add a FORM attribute to each page-related blocking activity. The FORM attribute would have a value which specifies the next page to be traversed.
3. Start the Page Flow
- You can start the page flow from a OAF page directly or upon triggered by some event or can start it from a static page by using the API OANavigation which provides createProcess() and startProcess()
- You can then transition through the workflow by using getNextPage() from OANavigation API. There are different overloaded getNextPage APIs for transitioning through workflow, transitioning to next page, resuming a saved transaction etc. You can get the code snippets in the OAF Dev guide.
4. Clear the Workflow Context
- Since the Workflow transaction holds an independent local JDBC connection, you must override the OADBTransaction.beforePoolCheckin() method in your root UI application module and call getDBTransaction.clearWorkflowInfo() to release the connection.
Some More features:
- Workflow-based page flows automatically support browser Back button navigation at the Workflow technology layer. Whenever user moves between the pages using browser Back button and resubmits, the workflow rewinds itself to the appropriate blocking activity so it stays in synch with the user's current navigation position.
- Workflow Page Flow can be used with Train and Navigator bar in a page, which the traditional 'Destination Function' based approach does not support.
- For the most part, you handle application errors in your Workflow-based page flows the same way that you do in any other context. That said, however, you need to consider the possibility that the user might fix mistakes and resubmit the form whenever you introduce workflow code.