How to convert a taskflow to portlet and use it (Jdev 11g TP4)

 

 

By W.ZH Mar 2009

 

 

Prepare

About the Preconfigured OC4J

Creating Task Flows

To make portlet from task flow

Deploy your portlet to the server

How to use the portlet in your port page

 

Bridge is an interesting tech in the web center. In 11g, task flow can run as the remote component on the web server. Then by building a bridge, in fact, just creating the portlet definition on the web center web server, a task flow can be exposed as a portlet for use. This portlet is just a description on the webcenter server; all functions and code still come from remote task flow. So only one source code for the task flow will be kept. So portlet consumers just need to use this portlet directly. They do not know this is a task flow running behind the portlet.

 

Prepare

 

You should know what is task flow in 11g, what is the portlet and how to develop a simple portlet. The case we are using Jdev 11g TP4, it has the webcenter support for 11g. Offical Oracle WebCenter Framework extension for Jdev 11g is not realease yet.

About the Preconfigured OC4J

 

There is Preconfigured OC4J in Jdev webcenter edition. Such as Jdev TP4. This one is dedicated for the server to contain the portlets. So you must use it to run your portlets.

 

To start Preconfigured OC4J:

1. Launch Oracle JDeveloper.

2. In the toolbar, click the Start WebCenter Preconfigured OC4J icon. If you do not see this icon or cannot start the WebCenter Preconfigured OC4J, ensure you have installed the Oracle WebCenter Framework extension.

3. If you are asked to install OC4J, click Yes. A readme.html file displays in Oracle

JDeveloper for the WebCenter Preconfigured OC4J. You can also test to see

whether OC4J is running by entering the following URL in your browser:

http://localhost:6688/

4. read the readme in detailed and try those default samples, preconfigured OC4J home is in the  JDEV_USER\oracle.adfp.seededoc4j\


 

Creating Task Flows

 

Just need to create a simple ADF project, and: 

1. In the Application Navigator, right-click the project where you want to create the task flow and choose New.

2. In the New Gallery, expand Web Tier node, select JSF and then ADF Task Flow and click OK.

3. In the Create ADF Task Flow dialog, the Create as Bounded Task Flow checkbox is selected by default.  

4. Click OK.

 

You will get your task flow like the task-flow-definition1.xml. Then you can start design your taskflow and then add the view and control flow to them. Please refer to the fusion ADF dev guide to know how to deal with task flow. You can also create a simple JSP page to test your task flow, just need to drag the task flow to your page. It will stay in page as a region. Then you can run your JSP to see wehter your task flow works or not.

 

To me, I just add one view page jsff, for the taks flow to do a simple search in the back bean.

 

After you make your task flow ready, then you can make it as a portlet,

 

To make portlet from task flow

 

1. In Oracle JDeveloper, open the JSF application that contains the task flow from

which you want to make a portlet.

2. In the Application Navigator, right click on the task flow that you want to

portletize and choose Create Portlet Entry.

 

And also there is a portlet.xml in your WEB-INF folder, you can right click this file to “manage portlet entries for task flow”, by this one, you can select any of your task flow in project to be portilized.

 

Deploy your portlet to the server

 

We use the Jdev default preconfiged OC4j. You must to start the Preconfigured OC4J first, and then build a connection to this server in your project,

 

Pack your project of portlet as war file and deploy to the preconfiged OC4j. After deploy successful, you can go to your portlet info page to review the info about it,

Such as, I name my war file default root as testPortlet, then my portlet info page should be http://127.0.0.1:6688/testPortlet/info, at this page you can get the WSDL URL location, on the bottom of this page. Copy that link (version 2) for use later.

 

How to use the portlet in your port page

 

Before your portal can use a portlet, you need to register the Portlet Producers first, of coz you should have a web project already:

 

  1. Ensure that you have started the WebCenter Preconfigured OC4J.
  2. In the Resource Palette, click the folder icon, then choose New Connection, and then Oracle PDK-Java Producer.
  3. On the Welcome page, click Next.
  4. On page 2 of the wizard, let’s enable this portlet producer to be used across all our applications. Select Resource Palette.
  5. In the Name field, enter  a name for your producer, such as testPortletProducer. Click Next.
  6. Enter this URL in the URL Endpoint field. Such as http://127.0.0.1:6688/testPortlet/portlets/wsrp2?WSDL , Click Next.
  7. On the Registration Details page, click Finish. You should see a message indicating that Oracle JDeveloper is registering your producer.

Your new portlet producer displays in the Connections list of the Resource Palette.  And under this producer, you can see all the portlets are list over there for your producer, include your task flow-portlet.

 

Then at any JSP page, you can just drag this portlet into your page, then run your page; you will see the portlet running.

 

Advertisements