Pages

Wednesday, December 24, 2008

Reuse remote Task Flows

In JDeveloper 11g is possible reuse pages in different applications. For example you can make one registration process which you can use in your all applications. If you breakup your application in reusable parts you can use these parts in all your applications, this will reduce maintenance and lower the complexity of your application because you now have small applications which has only one purpose. These parts must be bounded Task Flows and must contain at least one view and a Task Flow return component. We can deploy this TF to an application server and call this TF from your application. You will be automatically redirected to this TF and when we are finished we will return to your application.
Here is an example where I can press the remote button, this will open the Remote TF. The url of my application starts with http://127.0.0.1:7101/remoteTF-ViewController...

The remote TF is deployed to a WebLogic Application server, you can now see that the url of the TF is http://localhost:7001/remote/ . When we press back we will return to calling application


And we are back.
To do it yourself follow these steps. First create a new Application or ADF viewcontroller project. In the ViewController project we will create a bound task flow ( de-select the page fragments option). In this TF we add a view and a TF return component. Between these components we will add control flow case called return.

Select the task flow return component and provide a value to the name of Outcome. We need this value for the return control flow case of our calling application.

To make it more interesting let's add an input and a return parameter.

Deploy this TF to an application server. See this blog entry how to this. If you get a deployment error then it can help to remove the listener in the weblogic-application.xml. See the Oracle forums for more details.
The next step is to add an ADF library deployment profile to your TF and deploy your TF code to a jar.


Now go to your calling application and add this jar as a library to theviewcontroller project.
Open your unbounded Task Flow ( adfc-config.xml ). We can see the just created TF in the Component Palette and drag this TF to the unbounded TF


Let's add two control flow cases. The first called remote will open the remote TF and the second called back ( this need to have the same name as the outcome name of the task flow return component )
Because the remote TF is running on a other application server we need to provide the url. In my case http://localhost:7001/remote/faces/adf.task-flow? . This url must end with faces/adf.task-flow?.
This remote TF has an input and a return parameter so let's add a value to these parameters.

That's all. Here is the example workspace

No comments:

Post a Comment