Skip to main content

Architecting on demand solutions, Part 20: Develop task-processing portlets with new tooling in IBM Rational Application Developer

Automatic creation of JSF-based task portlets to enable human interaction

Wilfred Jamison, Ph.D., Software Engineer, IBM, Software Group
Dr. Wilfred C. Jamison
Dr. Jamison currently works with the IBM On Demand Software Development team and is heavily involved with many projects pertaining to business performance management and service-oriented architecture (SOA). His expertise also includes J2EE application servers, performance analysis, Tivoli Monitoring for Transaction Performance, Web services, and more. He is a contributor of the book, Performance Tuning for Linux Servers. Contact Dr. Jamison at wjamison@us.ibm.com.
Andreas Nauerz (andreas.nauerz@de.ibm.com), Software Engineer, IBM, Software Group
Author photo: Andreas Nauerz
Andreas Nauerz Andreas Nauerz works as Software Engineer in the IBM Laboratories at Boeblingen, Germany. His current work areas include Business Process Integration and Dynamic UI Management. He studied Computer Science at the University of Cooperative Education of Mannheim, the University of Staffordshire, the University of Saarbruecken, and the University of Hagen, respectively.
Juergen Schaeck (jschaeck@de.ibm.com), Software Engineer, IBM Boeblingen Lab
Juergen Schaeck is a Software Engineer at IBM Boeblingen Lab. Juergen holds a Master's degree from the University of Karlsruhe and currently works in WebSphere Portal Development. You can contact Juergen at jschaeck@de.ibm.com.

Summary:  Explore the tooling capabilities of IBM Rational® Application Developer V6.0.1.1 in this installment in the Architecting on demand solutions series. Simplify the development of business-process portlets for business process integration with IBM WebSphere® Portal V5.1.0.3. And automate the creation of relevant artifacts, such as JavaServer Faces (JSF) components, and the binding of input/output message properties. Process designers and portlet application developers working together to support business processing in their portals will find this article especially useful.

View more content in this series

Date:  16 May 2006
Level:  Intermediate
Activity:  1446 views
Comments:  

Introduction

In an on demand business environment, efficient customer, employee, and supplier interaction is critical. Your business needs to ensure that all users, regardless of role, can seamlessly participate and collaborate in business processes. Developers need to provide interfaces to support human interaction with business processes, such as filling out forms or responding to alerts.

Part 18 of this series introduces an insurance claim business process. This article uses that process to show how the business-process portlet tooling in Rational Application Developer V6.0.1.1 simplifies the development of business-process portlets for integration in WebSphere Portal V5.1.0.3.

In WebSphere Portal, each human task in a process is associated with a task page definition whose content always contains a task-processing portlet. This portlet retrieves the input message of a human task, displays it to the user, obtains user input, and passes it back as the output message to the Human Task Manager. (See Resources for more information.)

In this article, you are guided through the steps to develop task-processing portlets using the new features of Rational Application Developer. It is assumed that you are familiar with Business Process Integration (BPI) concepts.


Develop business process portlets with Rational Application Developer tooling

A WebSphere Portal business process application contains several components:

  • The business process (including control and data flow) and client information required to associate a task with a task page in a portal
  • Process initiation and task-processing portlets as the user interface (UI) to the process itself and the contained human tasks

Part 18 described the steps for enabling a business process for WebSphere Portal. In this article the focus is on the development of the task-processing portlets.

The real differentiations between all the types of task-processing portlets are the schema of the input or output message and the UI. The code to access the back end is always the same and operates on generic message classes. It can be separated and reused multiple times in different portlet projects. As a result, the portlet tooling of Rational Application Developer is now extended with new business-process portlet capabilities. The tool now provides two additional portlet project templates: one for task processing and one for business process instantiation portlets that already include any code required to communicate with the back end.

With Rational Application Developer, the development process is simplified because the portlet developer can focus on building UI instead of writing code. Because the new functions are based on the JavaServer Faces (JSF) framework, the JSF UI generation capabilities can also be used for business-process portlets. In this article, you learn the major steps for developing task-processing portlets as follows:

  1. Import the task interface and schema definitions of the input/output messages into Rational Application Developer for later use.
  2. Create the portlet project and the input/output message schemas are made available to the JSF framework.
  3. Generate the UI for the input/output messages. The binding to the data objects and back end is automatically performed.
  4. Export the portlet.

We'll also develop a portlet for the contact task introduced in Part 18 to go through each step. We'll also highlight the differences in the new Rational Application Developer tool.


Import the task interface and input/output message schemas

The task interface and schemas of the input/output messages are required to:

  • Generate the task-processing portlet.
  • Run-time access by the resulting portlet (which must be packaged as part of the portlet project).

The process developer exports the Web Services Description Language (WSDL) and XML Schema Definition (XSD) components that describe the tasks of the process as a JAR named InsuranceClaim.jar and sends it to the portlet developer. The JAR can be created by selecting the InsuranceClaim project, right-clicking it and selecting Export > JAR file.

Because the files must be available as part of a Rational Application Developer project and cannot be directly accessed from within the JAR, the portlet developer extracts the JAR and imports its content into a simple project. This can be created as follows.

  1. Select File > New > Project.
  2. Expand the node named Simple.
  3. Select Project.
  4. Enter the name InsuranceClaimInterfaces in the Project name field.
  5. Select Finish.

Be sure to use the Web perspective of RAD, and ensure that the Project Explorer view is selected. If not, it can be changed with the menu item Windows.

Now the portlet developer can import the WSDLs and XSDs, as follows.

  1. Right click on the created project displayed in the Project Explorer.
  2. Select Import > File system.
  3. Navigate to where you have stored your InsuranceClaim process project.
  4. Mark the folders that contain the (WSDL) interfaces and XSDs, as shown in Figure 1.
  5. Select Finish.

Figure 1. Importing WSDL and XSD files
Figure 1

Your project should now look similar to Figure 2.


Figure 2. New project tree
Figure 1

Create the portlet project and import required artifacts

Now that the preparation of the workbench is finished, you can create the portlet project using the following steps.

  1. Select File > New > Project.
  2. Select Portlet Project (JSR 168).
  3. Enter the name InsuranceClaimPortlets in the Name field.
  4. Ensure WebSphere Portal Version 5.1 is selected.
  5. Select Next.
  6. For the Portlet type, choose Faces Portlet (JSR 168) and select Next.
  7. On the next panel leave everything as it is, and select Next.
  8. On the PortletSettings panel, change Portlet Name and DisplayName to ContactCustomerPortlet and select Next.
  9. On the next panel, ensure that only View mode is marked. Change Initial Page to /ContactCustomerPortletView.jsp and select Next.
  10. On the next panel, select Enable business process integration.
  11. Choose Add Task Processing.
  12. Select Finish.

Your Rational Application Developer should now look similar to Figure 3.


Figure 3. The portlet project
Figure 3

Next we need to import the JAR files (for any input or output message classes that the task portlet will use) into the portlet project's /WEB-INF/lib folder.

  1. Expand your project until you can see the /WEB-INF/lib folder.
  2. Right-click the lib folder.
  3. Select Import > File system.
  4. Navigate to where you stored the JAR containing the messages of the InsuranceClaim process project.
  5. Select JAR and Finish.

The resulting project should now look like Figure 4.


Figure 4. Resulting project
Figure 4

We must make the input and output messages available to the JSF framework. To do that:

  1. Ensure the appropriate portlet page (JSP file) is opened. If not, double-click the JSP file (in our case the file ContactCustomerPortletView.jsp) as shown in Figure 5.
    Figure 5. ContactCustomerPortletView
    Figure 5
  2. Open the Business Process Messages wizard. As shown in Figure 6, from within the Page Data view, select New > Business Process Message.
    Figure 6. Business Process Message
    Figure 6
  3. Next, you need to decide whether the message should be used to initiate a business process or to handle a task of the business process. In this example, we want to develop a task-processing portlet. To do that:
  4. The next panel displays the defined port types, the operations inside each port type, and input/output messages for each operation. You want to display parts of the input message (compare to the steps in Part 18) and the form, to enter the values of the output message. To do that, select the input and output message, as shown in Figure 8.
    Figure 8. Input and output messages
    Figure 8
  5. Select Finish.

The wizard generates the necessary code and Javadoc annotations based on the information in the interface WSDL and schema files. After the code generation ends, the message becomes visible in the Page Data view, as shown in Figure 9, and is ready to be bound to a JSF UI component.


Figure 9. Page Data View
Figure 9

If the input message (for process initiation) or the output message (for task processing) includes complex types, they must be initialized in the getter method generated in the page code. Select Edit Page Code from the portlet JSP file's pop-up menu, and type the initialization code in the corresponding getter method for the message. For example, if attributes of the CustomerInfo and PolicyInfo are to be exposed, the highlighted code shown in Listing 1 must be added.


Listing 1. Initialization code
				
public Object getDoManualContactResponseMsg() 
{
   if (doManualContactResponseMsg == null) 
   {
     doManualContactResponseMsg = getSessionScope().get(TaskProcessingHelper.
        TASK_OUTPUT_MESSAGE);
			
     DataObject message = (DataObject) doManualContactResponseMsg;
			
     message.createDataObject("CustomerInfo");
     message.createDataObject("PolicyInfo");
			
   }

   return doManualContactResponseMsg;
}


Generate the UI

To generate the UI that represents the input/output messages, you must drag the input or output message properties from the Page Data view and drop them onto the JSP. This creates a corresponding JSF component and automatically binds the properties to the input/output message.

With the target portlet mode's JSP file still open, do the following steps:

  1. Select the input message properties, as shown in Figure 10.
    Figure 10. Input message properties
    Figure 10
  2. Right-click one of the properties.
  3. Select Insert new controls for selected objects.
  4. Select Display an existing record (read-only), as shown in Figure 11.
    Figure 11. Selecting fields to be displayed
    Figure 11
  5. Select Finish. Figure 12 shows the generated JSF component for this example.
    Figure 12. JSF component
    Figure 12
  6. Now select the output message parameters, as shown in Figure 13.
    Figure 13. Output message parameters
    Figure 13
  7. Select Updating an existing record, as shown in Figure 14.
    Figure 14. Inserting a record
    Figure 14
  8. Select Finish. You can see the generated JSF component in Figure 15.
    Figure 15. Generated JSP component
    Figure 15

You can remove the Delete button since it is not needed for this case. Finally, the remaining step is to add the code behind the Submit button using the tool.

  1. Unfold the actions folder in the Page Data view.
  2. Drag and drop the processTask item, shown in Figure 16, on the Submit button.
    Figure 16. Binding code for Submit button
    Figure 16
  3. Save the JSP.

This step results in an automatic linkage of the processTask code with the button. We can view the generated code by selecting the button and selecting Quick Edit.

Important steps for portlets for WebSphere Process Server processes

This section has a few required steps for portlets that should be generated for WebSphere Process Server processes. The interface editor of WebSphere Integration Developer uses a WSDL style called "Document Literal Wrapped" that generates a complex type around the input/output data objects defined on the editor. Because Rational Application Developer 6.0.1.1 is the first release that tolerates WebSphere Process Server processes, that style is not yet completely supported and you need to perform some manual steps.

First, you need to update the created DataObject references in the JSPs. (Note the way the JSPs display depends on the defined task interfaces.)

Take a look at the following example (Figure 17), where we define the operation doManualContact with the input claimRequest.


Figure 17. Defining the operation
defining the operation

In the source code of the generated JSP, you will see an entry like that shown in Listing 2. The doManualContactParameters part is the wrapper around the claimRequest input message defined in the editor and must be removed. So change the line to the one in Listing 3.


Listing 2. Remove all references
pc_ContactCustomerPortletView.doManualContactRequestMsg.doManualContactParameters.
   claimRequest.claimType

Change the references in the JSP to that shown in Listing 3.


Listing 3. Changing all references
pc_ContactCustomerPortletView.doManualContactRequestMsg.claimRequest.claimType

To create a portlet for the WebSphere Process Server platform, you must define the correct property resolver.

  1. Open the faces-config.xml file in the \WEB-INF folder.
  2. Replace the line in Listing 4 with the line shown in Listing 5.

Listing 4. Open the faces-config file
<property-resolver>com.ibm.faces.databind.SelectItemsPropResolver
   </property-resolver>


Listing 5. Changing the faces-config file
<property-resolver>com.ibm.faces.sdo.bp.SDOPropertyResolver
   </property-resolver>

Save your changes.


Export the created task portlets

Next, you need to export the project as a WAR file to generate our deployable using these steps:

  1. Right-click on the project.
  2. Select Export > WAR file.
  3. Enter appropriate values in the available input fields.

So now you can deploy the portlets using the WebSphere Portal administration and assemble the Task Pages. (See Part 18 for more information.)

Process initiation portlets

In this section you learn how to generate the Process initiation portlet. The procedure is quite similar to developing task processing portlets. You will notice the difference in the following steps when you reach steps 9 and 10.

  1. Select File > New > Project.
  2. Select Portlet Project (JSR 168).
  3. Enter a name in the Name field.
  4. Ensure WebSphere Portal Version 5.1 is selected, then click Next.
  5. Choose Faces Portlet (JSR 168) for the portlet type, and select Next.
  6. On the next two panels, leave everything as it is and select Next.
  7. Ensure that only View mode is marked, and select Next.
  8. Check the Enable business process integration box.
  9. Choose Add Process Initiation.
  10. Enter the template name of the process to be initiated into the Template name field.
  11. Select Finish.

The UI (relevant input fields and buttons) is created similarly to the UI of task processing portlets.

Note: If you build process initiation portlets for WebSphere Process Server, you need to perform the following extra steps.

  1. Open the Deployment Descriptor (web.xml) of the portlet project.
  2. Select the References tab.
  3. Change the Name field from ejb/BusinessProcessHome to ejb/BusinessFlowManagerHome.
  4. Change the Home field from com.ibm.bpe.api.BusinessProcessHome to com.ibm.bpe.api.BusinessFlowManagerHome.
  5. Change the Remote field from com.ibm.bpe.api.BusinessProcess to com.ibm.bpe.api.BusinessFlowManager.
  6. If you define the JNDI name, be sure to also replace BusinessProcessHome with BusinessFlowManagerHome.
  7. You also need to perform the steps described in Important steps for portlets for WebSphere Process Server processes.

Summary

When building business processes that involve human tasks, developing task-processing and process-initiation portlets is necessary. This article provided sufficient information about how to do this using the new capabilities of IBM Rational Application Developer V6.0.1.1. These capabilities offer a simplified development process by automating the creation of the relevant artifacts, such as a JSF component and the binding of input/output message properties. The result is an easier and faster methodology for the developer.



Download

DescriptionNameSizeDownload method
Sample codei-odoebp20code.zip2.46MB HTTP

Information about download methods


Resources

Learn

Get products and technologies

Discuss

About the authors

Dr. Wilfred C. Jamison

Dr. Jamison currently works with the IBM On Demand Software Development team and is heavily involved with many projects pertaining to business performance management and service-oriented architecture (SOA). His expertise also includes J2EE application servers, performance analysis, Tivoli Monitoring for Transaction Performance, Web services, and more. He is a contributor of the book, Performance Tuning for Linux Servers. Contact Dr. Jamison at wjamison@us.ibm.com.

Author photo: Andreas Nauerz

Andreas Nauerz Andreas Nauerz works as Software Engineer in the IBM Laboratories at Boeblingen, Germany. His current work areas include Business Process Integration and Dynamic UI Management. He studied Computer Science at the University of Cooperative Education of Mannheim, the University of Staffordshire, the University of Saarbruecken, and the University of Hagen, respectively.

Juergen Schaeck

Juergen Schaeck is a Software Engineer at IBM Boeblingen Lab. Juergen holds a Master's degree from the University of Karlsruhe and currently works in WebSphere Portal Development. You can contact Juergen at jschaeck@de.ibm.com.

Comments



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Sample IT projects, Architecture
ArticleID=111716
ArticleTitle=Architecting on demand solutions, Part 20: Develop task-processing portlets with new tooling in IBM Rational Application Developer
publish-date=05162006
author1-email=wjamison@us.ibm.com
author1-email-cc=wjamison@us.ibm.com
author2-email=andreas.nauerz@de.ibm.com
author2-email-cc=
author3-email=jschaeck@de.ibm.com
author3-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).