Creating a composite application for IBM Lotus Notes 8 using IBM WebSphere Portlet Factory

Currently, many tools have been developed to create composite applications such as IBM® Lotus® Domino® Designer, IBM Lotus Component Designer, and IBM Rational® Application Development. This article introduces a new way to create composite applications in IBM Lotus Notes® 8 using IBM WebSphere® Portlet Factory.

Share:

Zhao Hui Nie (niezh@cn.ibm.com), Software Engineer, IBM

Zhao Hui Nie is a software engineer with the IBM WebSphere Dashboard Framework development team in the IBM China Software Development Lab. He designs and develops basic builders for WebSphere Dashboard Framework. You can reach him at niezh@cn.ibm.com.



Dong Fei Wu (wudongf@cn.ibm.com), Software Engineer, IBM

Dong Fei Wu is a staff software engineer with the IBM WebSphere Dashboard Framework development team in the IBM China Software Development Lab. He designs and develops basic builders for WebSphere Dashboard Framework. You can contact him at wudongf@cn.ibm.com.



16 September 2008

WebSphere Portlet Factory is a powerful and flexible tool for rapidly building portlets and Web applications on top of a service-oriented architecture. In version 6.1, it added the ability to create portlets that can run on rich client platforms, such as IBM Lotus Expeditor and Lotus Notes 8. With this feature, users can develop a composite application on IBM Lotus Notes 8 quickly and efficiently. In this article, we provide a step-by-step guide to creating a composite application in Lotus Notes 8 using this tool.

This article is written for rich client application developers who have experience working with WebSphere Portlet Factory and who want to create composite applications in Lotus Notes 8.

This article includes instructions on how to:

  • Create portlets using WebSphere Portlet Factory.
  • Develop a Web application bundles package on a rich client platform.
  • Create a property broker in a composite application using WebSphere Portlet Factory.
  • Deploy the WebSphere Portlet Factory built-in Web application bundle in Lotus Notes 8 and generate composite applications.

Prerequisites

Readers should have a good understanding of the WebSphere Portlet Factory, Lotus Notes 8, and composite applications.


Introduction

In this article, we use a sample to show the step-by-step instructions to create a composite application using WebSphere Portlet Factory. First, we create two portlets using WebSphere Portlet Factory that can communicate with each other using a property broker (you can also download the models in the CompositeAppSample.zip file in the Downloads section of this article and import them into your project). Then we create a Web application bundle package using WebSphere Portlet Factory and deploy it in Lotus Notes 8 (you can download the WPFExpeditorUpdateSiteCompositeApplicationDemo.zip file in the Downloads section of this article). You can deploy this file to Lotus Notes 8 directly and create the composite application using the artifact in this package. Last, create a composite application in Lotus Notes 8 using these two portlets.


Create sample portlets

WebSphere Portlet Factory is an Eclipse-based tool for rapidly developing Websphere Portal and WebSphere Application Server applications. You can use it to create the project once and to deploy it to WebSphere Portal, WebSphere Application Server, or Lotus Notes 8 without further programming. A WebSphere Portlet Factory project contains all the artifacts that it requires to build the portlets or the Web applications. First, let’s follow the steps below to create the project.

  1. Select File - New - WebSphere Portlet Factory Project in the Eclipse IDE to create a project. See figure 1.
    Figure 1. Create a WebSphere Portlet Factory project
    Create a WebSphere Portlet Factory project
  2. Click Next, and name the project CompositeApplication.
  3. Click Next to go to the Deployment Configuration window. Click Add in the Portal Server Deployment Configuration window to add the server configuration for deployment. WebSphere Portlet Factory lets you deploy the model as a Web application on an application server (for example, on WebSphere Application Server or Tomcat) or run the model as a portlet on a portal server, such as WebSphere Portal. In this article, you need to create only the portlets to show the demonstration, so let’s add the configuration for WebSphere Portal as shown in figure 2.
    Figure 2. Add the deployment configuration for WebSphere Portal
    Add the deployment configuration for WebSphere Portal

    Click OK to add the deployment configuration for WebSphere Portal. Click Finish to complete the project creation. Select yes when you are asked if you want to deploy the application.

After you have created the project, then you create two models. One displays a table of sales representative; the other displays a table of potential customers. These two models are wired using a property broker. When users click a sales representative in the first table, the second table shows the corresponding customers. Let’s follow these steps to create the models:

  1. Create a new folder under WEB-INF/models called CompositeApplication.
  2. Create a new model called SalesRep.model, which is used to display the sales representative table. Add the following builders to this model:
    • Portlet Adapter builder
    • Variable builder
    • Simple Schema Generator builder
    • Page builder
    • Data Page builder
    • Action List builder
    • Cooperative Portlet Source builder

Portlet Adapter builder

This builder is used to enable this model as a portlet on WebSphere Portal or Lotus Notes 8. Specify the builder name as SalesRepDemo and the portlet title as Sales Rep Demo in the builder input fields.

Variable builder

You use this builder to store the source data for the sales people. In a real product, the data can be stored in a database or in other repositories. WebSphere Portlet Factory also provides support for the integration with other systems such as Microsoft® Excel files, a database, an IBM Lotus Domino server, or an SAP server. To simply the demo, set the data in a variable. Let’s use the XML segment in listing 1 to set the variable.

Listing 1. XML segment for the variable builder
<RowSet>
		<Row><Name>Mike</Name><Location>
		United States</Location></Row>
		<Row><Name>Jason</Name><Location>
		Canada</Location></Row>
		<Row><Name>Tom</Name><Location>
		China</Location></Row>	
		<Row><Name>Cindy</Name><Location>
		Japan</Location></Row>	
</RowSet>

Simple Schema Generator builder

This builder is used to generate the schema that describes the XML variable. Enter the following inputs field for this builder.

  • Name. Enter schema field as the name.
  • Sample Data. This is the name of the Variable builder that you created as source data, so set the value as salesrep.
  • Modify Variable. Check this field to make sure that the original data XML file refers to the new added schema.

Page builder

Enter the name page1. This builder then generates a page in the model called page1.

Data Page builder

This builder creates a table to display the sales representatives. Set the following builder values and leave other values at their default settings:

  • Variable. The variable is used to set the data that the table shows. Here, set the value as Variables/salesrep/RowSet, which you created using the Variable builder.
  • Page in Model. This setting indicates the page on which the table is shown. Set the page as page1, which you can add using the page builder.
  • Location for New Tags. This setting is the page tag in page1 where the table is located. Select the default tag nametag.

Action List builder

The Action List builder is used to specify a list of actions or methods that run in the model. Enter main as the name to make this ActionlList the entry point of this model, and select page1 in the actions list. Then page1 is shown when the model runs.

Cooperative Portlet Source builder

This builder makes this model a message source portlet. WebSphere Portlet Factory provides two builders (the Cooperative Portlet Source builder and the Cooperative Portlet Target builder) so that users can create portlets that interact with each other to share information. Use the Cooperative Portlet Source builder to add a link to each row in the table. When you click the link in the table, it sends the name id from the source model to the target. Enter the following input fields in the Cooperative Cortlet Source builder UI as shown in figure 3:

  • In the Name field, enter SalesRepSource.
  • In the Type field, enter Property Broker Link for the connection type because the Lotus Notes 8 platform supports only this kind of communication. Choosing this type generates a link on the page, so you also need to specify the page location for this builder.
  • In the Page Location area, do the following:
    • Select the On Named Tag option for location technique.
    • In the Page field, enter page1 to indicate where you want to place the property broker link.
    • In the Tag field, enter Name.
  • In the Namespace field, enter http://www.ibm.com/samples/portlet_communication.
  • In the Output Definitions section, do the following:
    • In the first row of the Name list, enter SalesRep and then enter the following information:
      • In the Output Type Name field, enter SalesRepType.
      • In the Output Type field, enter xsd:string.
      • In the Value field, enter ${Variables/RowLoopVar/Row/Name}.
      • In the Caption field, enter Sales Rep.
Figure 3. Cooperative Portlet Source builder UI
Cooperative Pportlet Ssource builder UI

Create the target model

Create the target model Customer.model. This model displays the potential customers’ information based on the sales representative that the user selected in the SalesRep.model. Add the following builders to this model:

  • Portlet Adapter builder
  • Variable builder
  • Simple Schema Generator builder
  • Page builder
  • Data Page builder
  • Action List builder
  • Method builder
  • Cooperative Portlet Target builder
  • Event Handler builder

Portlet Adapter builder

Just as you did in the Portlet Adapter builder in the SalesRep.model, enter CustomerDemo in the Name field and Customer Demo in the Portlet Title field.

Variable builder

In this model, you need to add two Variable builders. One represents the customer data, similar to the variable builder in the SalesRep.model; the other stores the customer information that is selected in the SalesRep.model. Let’s add two variable builders called Customers and SelectedCustomers, and set the input fields for each builder.

For the Customers variable, enter the name as customers and select the XML type for the variable. Then use the XML segment shown in listing 2 to set the value.

Listing 2. XML segment for the variable builder
<RowSet>		<Row><Campany>WW</Campany>
<SalesRep>Jason</SalesRep><Opportunity>High
</Opportunity></Row>
<Row><Campany>Orange</Campany><SalesRep>Jason</SalesRep>
<Opportunity>Med</Opportunity></Row>
<Row><Campany>Smoke Steel</Campany><SalesRep>
Mike</SalesRep><Opportunity>Low</Opportunity></Row>
<Row><Campany>Book Master</Campany><SalesRep>
Cindy</SalesRep><Opportunity>High</Opportunity></Row>
<Row><Campany>Inter Travel</Campany><SalesRep>
Cindy</SalesRep><Opportunity>Med</Opportunity></Row>
<Row><Campany>Coffee</Campany><SalesRep>
Cindy</SalesRep><Opportunity>Low</Opportunity></Row>
<Row><Campany>Ice Machine</Campany><SalesRep>
Tom</SalesRep><Opportunity>High</Opportunity></Row>
	<Row><Campany>Tim Bank</Campany><SalesRep>
	Tome</SalesRep><Opportunity>Med</Opportunity></Row>
</RowSet>

For the SelectedCustomers field variable, enter the name as selectedCustomers, and select the Type as schema/RowSet. Leave the other input fields as default values.

Simple Schema Generator builder

Similar to the Simple Schema Generator builder in the SalesRep.model, you add the Simple Schema Generator builder to the Customer.model to describe the XML value of the variable. Set the name as Schema, select the variable Customers for the sample data, and select the option Modify Variable input field.

Page builder

Set the name as page1. This builder generates a page in the model called page1.

Data Page builder

This builder creates a table in which you can display the customer information of each sales representative. Set the following builder input fields and leave all other input fields at their default settings.

  • In the Variable field, enterVariables/selectedCustomers/RowSet.
  • In the Page in Model field, enter page1.
  • In the Location for New Tagsfield, enter namedTag.

Action List builder

As you did in the Action List builder in the SalesRep.model, you set the name as main and you add page1 to the actions list.

Method builder

The Method builder creates a method in the model. Here, you use a Method builder to create a method to update the selectedCustomers variable. This method is called by the event handler when users click a row in the SalesRep.model. Set the following builder input fields:

  • In the Name field, enter updateSelectedCustomers.
  • In the Arguments field, enter the argument name as SalesRep and the Data Type as String.
  • In the Method Body field, enter the code shown in listing 3.
Listing 3. Code for the Method Body field
		IXml customers=webAppAccess.getVariables().getXml("customers");
IXml result = XmlUtil.create("RowSet");
for(IXml row = customers.getFirstChildElement();row !=null;row =
row.getNextSiblingElement()){
if(SalesRep.equals(row.getText("SalesRep"))){
result.addChildElement(row.cloneElement());
}
		}
		webAppAccess.getVariables().setXml("selectedCustomers", result);

Cooperative Portlet Target builder

This builder is used to get the event generated by the Cooperative Portlet Source builder from Customer.model. Enter the following information as shown in figure 4:

  • In the Event Name field, enter SalesRepEvent. This field generates the event name, which can be integrated with the Event Handler builder.
  • In the Input Name field, enter SalesRep. The input name in this builder must be same as the output name in the Cooperative Portlet Source builder.
  • In the Input Type field, enter xsd:string. The input type in this builder must be same as the output type in the Cooperative Portlet Source builder.
  • In the Input Type Name field, enter SalesRepType. The input type name in this builder must be same as the output type name in the Cooperative Portlet Source builder.
  • In the Caption field, enter Sales Rep.
Figure 4. Cooperative Portlet Target builder UI
Cooperative Portlet Target builder UI

Event Handler builder

This builder is used to handle the event generated by the Cooperative Portlet Target builder and to delegate the event to the relative action. Do the following:

  • In the Name field, enter SalesRepEventHandler.
  • In the Event Name field, select the event name SalesRepEvent, which is generated by the Cooperative Portlet Target builder.
  • In the Handler Type field, Select the Use existing action option.
  • In the Action field, select the method updateSelectedCustomers.

Create a Web application bundle package using WebSphere Portlet Factory

With WebSphere Portlet Factory V6.1, you can generate a Web application bundle, an Eclipse feature referencing that bundle, and an Eclipse update site where that feature and plug-in can be installed, all from the project that you created in the previous steps. The Web application bundle package includes the portlets that are deployed on Lotus Notes 8. Let’s follow the steps below to create the artifacts used to deploy the application on Lotus Notes 8.

By default, the rich client platform support is not enabled in a WebSphere Portlet Factory project, so you need to enable it first. Right-click the project name, and select the Properties option on the project menu to display the Properties window as shown in figure 5.

Figure 5. Enabling the rich client platform support in the WebSphere Portlet Factory project
Enabling the rich client platform support in the WebSphere Portlet Factory project

In the Properties window, expand the WebSphere Portal Factory Properties item on the left, and then select Rich Client Platform.

The configuration fields for the rich client platform are shown on the right side. By default, the feature name, feature description, and feature and plug-in identifier are set to the project name, but you can change them to more descriptive names if you choose. On this page, be sure to select the option “Build a Rich Client Platform Web Application Bundle for this project” to see the optional RCP-related input fields to the portlet adapter builder. Click OK to close thewindow.

Next, open the models that you created in the previous steps, and double-click the portlet adapter builder in these models to open the builder inputs UI. You can see that a new section called Rich Client Platform has been added to the builder inputs UI (see figure 6). This section is visible only if you enabled rich client platform support in the project's properties window. You can specify the input fields according to your requirements. For this article, keep the default values.

Figure 6. The rich client platform are of the builder input UI
The rich client platform area of the builder input UI

Next, build the Web application bundle plug-in, feature, and update site from the project. Right-click the project name, and then select Rich Client - Build WAB for rich client as shown in figure 7.

Figure 7. Building the Web application bundle package from the project
Building the Web application bundle package from the project

If the Web application bundle package was created successfully, you can find a new folder at the root of your project called WPFExpeditorUpdateSiteCompositeApplicationDemo, as shown in figure 8.

Figure 8. The update site created in the project
The update site created in the project

This new folder is an Eclipse/OSGi update site containing the Web application bundle plug-in, the Eclipse/OSGi feature referencing that plug-in, and a site.xml file describing the feature available at this update site.

Now, you have created the Web application bundle package and the update site. Next, you are going to deploy the portlets to the Lotus Notes 8 client and create the composite application with them.


Prepare the Lotus Notes 8 client for deploying the Web application bundle package

To deploy and run the rich client components generated by WebSphere Portlet Factory, you should do some preparation to the Lotus Notes 8 client to support it.

  • Expose the Eclipse update manager in Lotus Notes 8.

    The Lotus Notes client architecture and menu can be used by authorized developers and users to install additional plug-ins to their Lotus Notes client. You can check if this function is enabled by verifying that you can see the menu File - Application - Install in the Lotus Notes 8 client. If this function is not enabled, you should enable it first before installing any additional plug-ins to the Lotus Notes client. Note that this function is not enabled by default in the Lotus Notes client, so follow these steps to enable it:

    1. Open the configuration file PLUGIN_CUSTOMIZATION.INI in the folder <Notes_install_dir>/framework/rcp/, and add a new line com.ibm.notes.branding/enable.update.ui=true.
    2. Save the changes and restart the Lotus Notes client. You can see that the menu File - Application - Install is now available in the Lotus Notes client.
  • Install the JSP compiler bridge feature for the Lotus Notes client if you are using Lotus Notes 8.0.0.

    The JSP compiler bridge feature for Lotus Notes provides the support for dynamic JSPs and allows the Lotus Notes client to run rich client components built by WebSphere Portlet Factory V6.1. If you are using Notes 8.0.1 or a later release, you don’t need to install this feature because it is part of the installation kit. If you are using Lotus Notes 8.0.0, you should install this additional feature to enable the support for dynamic JSPs. Describing how to install this feature is out of the scope of this article. You can find the step-by-step instructions to install the JSP compiler bridge feature in this article.


Deploy the Web application bundle package onto Lotus Notes 8

After the update site has been created and the Lotus Notes 8 client has been prepared for installing additional plug-ins, you can deploy the Web application bundle package created by WebSphere Portlet Factory into Lotus Notes 8 using the application manager. Select File - Application - Install to open the new feature set's update window as shown in figures 9 and 10.

Figure 9. Install the new features in Lotus Notes 8
Install the new features in Lotus Notes 8
Figure 10. Select the feature sets to install
Select the feature sets to install

Select the "Search for new features to install" option and click Next.

Figure 11. Add the feature sets to install
Add the feature sets to install

In the application Install window, shown in figure 11, click Add Folder Location because you are going to use the file-system-based folder location for the generated update site for the project. If you choose to move that folder to an HTTP server or to a Java™ Platform, Enterprise Edition- based application server with the update site option in the rich client platform Properties window, then you use the "Add Remote Location" option to specify an HTTP-based URL to your hosted update site.

Click Add Folder Location to open the folder window and select the update site that you created using the Websphere Portlet Factory Designer. Click Finish. The window that opens shows the available features on the update site (see figure 12).

Figure 12. Select the features to install
Select the features to install

Select the features in it and click Next. Accept the license and click Finish to complete the installation process. The selected features from the update site that you provided to the Lotus Notes client platform are then installed. After the features have been installed, click Yes to restart Lotus Notes.


Create the composite application on Lotus Notes 8

After the Web application bundle package has been installed successfully on Lotus Notes 8, you can use the portlets in the Web application bundle package to create the composite application on the Lotus Notes 8 client. Follow these steps to create the composite application:

  1. Create a blank composite application template by selecting File - Application - New as shown in figure 13.
    Figure 13. Create a new application in Lotus Notes 8
    Create a new application in Lotus Notes 8

    Selecting New opens the New Application window, where you can specify the application name, location, and the template. To simplify the process, create a blank composite application as shown in figure 14.

    Figure 14. Create a blank composite application
    Create a blank composite application
  2. Add the portlets to the composite application.

    After you create a blank composite application, an application page with no content is added to the Lotus Notes 8 client. Use the composite application editor to add content to it. Select Action - Edit Application to open the composite application editor as shown in figure 15.

    Figure 15. Edit the composite application
    Edit the composite application

    By default, Lotus Notes 8 provides a couple of components for integration in a composite application; you can find them in the Component Palette (see figure 16). Next, you add the components (portlets) created by WebSphere Portlet Factory to the composite application editor palette and use them to create the composite application.

  3. Select Tools - Component Palette - Add Components - Add Components from Update Site as shown in figure 16.
    Figure 16. Add the components from the update site
    Add the components from the update site
  4. Selecting the Add Locally Installed Components option displays the window that shows the components that have been installed in Lotus Note 8. See figure 17.
    Figure 17. Select the local components that have been installed in Lotus Notes 8
    Select the local components that have been installed in Lotus Notes 8
    .
  5. Select the CustomerDemo and SalesRepDemo components in this window, and click OK. You can see that these two components are added to the Component Palette in figure 18.
    Figure 18. The two components added to the Component Palette
    The two components added to the Component Palette

    After the components have been added to the Component Palette, you can add the components to the composite application easily by dragging the components to the edit page. Let’s drag the two components into the blank page in the middle of the integrated development environment as shown in figure 19.

    Figure 19. Drag the two components into the composite application
    Drag the two components into the composite application

As you can see, the two portlets that you created are in the composite application. Next, you need to wire these portlets because they are using the property broker to communicate with each other. Follow these steps to create the wiring between these portlets:

  1. Select Edit - Page - Wiring. As you can see in figure 20, the message name is shown in the portlets, which means that you need to connect them by dragging the message name from the source to the target.
    Figure 20. Create the wiring between the portlets
    Create the wiring between the portlets
  2. Click OK and rename the application name Composite Application. Then close the edit page to finish the application editing and return to the Lotus Notes 8 client. You can see that the two portlets have been integrated in a composite application; clicking the name in the left table shows the related information in the right portlet. See figure 21.
    Figure 21. The composite application created in Lotus Notes 8
    The composite application created in Lotus Notes 8

Conclusion

WebSphere Portlet Factory is a powerful tool for developing portlet and Web applications on top of a service-oriented architecture. In version 6.1, it also adds the ability to extend the portlet for use on the rich client platform. In this article, we used a sample to demonstrate how you can use WebSphere Portlet Factory to create the composite application in the Lotus Notes 8 client.


Downloads

DescriptionNameSize
Code sampleCompositeAppSample.zip8KB
Code sampleWPFExpeditorUpdateSiteCompositeApplicationDemo.zip8KB

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into IBM collaboration and social software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Lotus, WebSphere
ArticleID=338221
ArticleTitle=Creating a composite application for IBM Lotus Notes 8 using IBM WebSphere Portlet Factory
publish-date=09162008