Pages

Wednesday, November 14, 2007

re-use taskflows in other taskflow apps

In JDeveloper 11g you can re-use taskflow in two ways . Make an adf library or deploy the application to an oc4j 11g container and use a taskflow call with this remote url.
This can be very usefull if you have many applications in your company with the same components like login flow etc. You can also use it if you have a central customer hub and want to maintain this customers from different applications and don't want to make this functionality twice.
First I made an adf taskflow project with an bounded login taskflow. This login flow does not nothing. I de-select the create with page fragment.
This taskflow has two view , the default view is a login and the other is a new user page and a wildcard control flow rule so I can call the succes and abort return activity from both views. Let's create the login and new user page and put in some adf command buttons with the succes,newuser and abort action.
Now we are ready to deploy this to an adf library and to an oc4j container.
Make in this project first a adf library jar deployment and generate this jar. Now you can use this login flow in other projects. Open an other adf taskflow project and add the generated login flow jar to this project.

If you open the adfc-config.xml you see in the component Paletten the login flow. Now you can use this page flow. The only down site is that the pages like new user and login in this login flow can not be used. When you run it it tries to look for the pages in the current webapp and not in the jar.

You can use this option perfectly for your own taskflow templates library.

Let's re-open the login flow project and create a war deployment so we can deploy this webapp to an oc4j 11g container. I use the oc4j container from jdeveloper 11g and put in some enviroment variables to the bin\oc4j.cmd file.
set ORACLE_HOME=D:\oracle\jdevstudio1111_preview2
set JAVA_HOME=D:\oracle\jdevstudio1111_preview2\jdk
set OC4J_JVM_ARGS=-mx512M -ms256M -Xrs -XX:MaxPermSize=128M

We can start the container with bin\oc4j .cmd -start. Make in jdeveloper an application connection to this standalone oc4j and deploy to this application server.
We go to the other project and open the adfc-config.xml and drop a task flow call to this diagram with three control flow cases the first is login to call the login flow and put in a commandbutton with this action , succes then we go back to emp and abort then we go the other page so we can see that abort and succes works.
The last step is to configure the login task flow call.


The remote url is http://localhost:8888/login-ViewController-context-root/faces/adf.task-flow? This is the login webapp url. You can use a backing bean for this so you can use an another url for production. without making more versions. The id is the login task flow id and the last is the login taskflow xml filename /WEB-INF/login-taskflow-definition.xml.

We are ready to start the new application.

No comments:

Post a Comment