Many of us have tried our hands at 'portalizing' Notes/Domino applications, be it through Portlet Builder for Domino, the Domino View portlet or perhaps even the portlet and Domino APIs for Java.
I'm willing to bet that just as many of us have experienced frustration as a result. The Portlet Builder for Domino, while providing a simple interface that requires little or no coding, simply doesn't offer the power of the Java APIs, and is useful for only the most basic applications.
On the other hand, Java APIs provide access to all of the functionality that portal and Notes/Domino have to offer -- but this power doesn't come cheaply. Developing portlets from scratch in Java is very time consuming and requires some pretty serious Java development skills.
It is not uncommon for portlet projects to never see the light of day, because they are simply too expensive to develop. Those that do begin often go over budget because of how easy it is to underestimate the time required to develop portlets in Java.
But Notes/Domino developers need not despair. IBM WebSphere Portlet Factory (WPF) provides a good balance between power, ease of use and speed of development -- even for those of us with no experience in Java.
Although WebSphere Portlet Factory installs into the Eclipse framework -- a Java-based IDE, most of the code is written for you by 'builders,' a kind of wizard in WPF. The builders that come with WPF out of the box are remarkably powerful.
In fact, with a bit of ingenuity, it should be possible to portalize many Notes/Domino applications without coding a single line of Java -- although the option is always there to extend your portlets with Java code should you see fit.
The following sections illustrate a few of the more useful things that a Notes/Domino developer should know about building portlets in WebSphere Portlet Factory.
Enabling Notes/Domino to talk to WPF
Before you get started in WPF, the first thing you need to do is configure a few things on the Lotus Domino server you wish to use. You will need to make sure that the DIIOP and HTTP tasks are running, and that the 'Allow HTTP clients to browse databases' option is checked on the server document.
Make sure that the DIIOP task has correctly started and is not being blocked by a firewall -- you can test your DIIOP connection by accessing the URL here: http://youdominoservername.com:63148/diiop_ior.txt. -- but substituting your own Lotus Domino server name. A successful test should return an IOR string.
Serving up Notes/Domino views and forms
The easiest way to get started here is to create a new model and then add the Notes/Domino view and form through the wizard. Because we are working with portlets, think of each model in your project as a separate portlet, and the project as a container of these portlets, which is what you actually deploy to the portal server.
To create a model, select File -> New -> Other, and then 'Factory Model' from the IBM menu. Select 'Domino' as the model type. If this option does not appear, make sure you have added the 'Lotus Collaboration Extension' feature to the project -- if not, you can add it by right clicking on the project, selecting Factory Feature Set -> Add, and then selecting 'Lotus Collaboration Extension.'
Also, make sure you select the 'Enable the application to be used as a portlet in a portal' checkbox in the wizard. Once you've finished the wizard, have a look at the resulting builders and how they're configured. These builders -- and many others -- can be added to a model at any time from the builder palette by clicking on the little cog icon with a plus sign on it. It is located at the top of the builders view.
A few things are worth noting at this point:
- Some configuration settings will be stored by the wizard in the WEB-INFdomino_configdefault_domino_server.properties file. This file contains the server, username and password you will use to access the database that contains the view and form.
- The user specified in this file must have access to the database you are trying to connect to.
- There is an option at the bottom of the Domino View and Form builder called 'Generate Main.' A model can only have one 'main' procedure, and it is this procedure that specifies the program execution. If you want more control over the process flow, uncheck the 'Generate Main' box, add a new action list from the builder palette and call it 'main'.
Formatting Domino views and forms
There are several quick and easy ways to format Notes/Domino views and forms in WPF. One of the easiest is to use your own HTML templates and style sheets, which you can specify in the Domino View and Form builder. For more information on using HTML templates in WPF, see: http://whitepapers.zdnet.com/whitepaper.aspx?docid=241075&promo=100202.
Other useful builders include the 'Rich Data Definition' builder, which lets you specify formatting, translation, validation and visibility of fields; and the 'Data Hierarchy Modifier' builder, which lets you order fields on a page and group them into categories.
Running an agent
The usefulness of agents in WPF cannot be overstated, as they allow you to use Notes/Domino agents to handle business logic for portlets -- without the need to code in Java. Of course, there's nothing stopping you from writing your agents in Java if you prefer it.
Once you have an agent in Notes/Domino, open the model you wish to use and make sure that you have a view builder in the model, -- such as a Domino View and Form builder. You will use this view to reference the database that contains the agent.
Add an Action List builder, and add an action by pressing one of the ellipses buttons in the 'actions' listbox. From the subsequent menu, select the following command: MyViewNamerunAgent, where 'MyViewName' is the name of your view builder.
You will then need to specify two parameters to the function -- the first will be the name of your agent in Notes/Domino and the second will be the UNID of the currently selected document. To specify the second parameter, select 'MyViewNameselectedUNID' from the variables folder, where 'MyViewName' is the name of your view builder. Note that no quotes are used for any of the parameters.
Creating charts based on Domino data
Creating a chart in WebSphere Portlet Factory couldn't be easier. Just make sure you have the 'Greenpoint Web Chart Builder' feature added to your project, and then add a 'Web Charts' builder to your model. Point the Web Charts builder to an existing view builder in your model.
The chart is generated from XML built from the view in the view builder, and it is possible to modify this XML in a Java method. However, if you want to change the data that is being graphed, the simplest solution is to modify the view that the view builder is pointing to, which saves you needing to code in Java.
Getting your versions right
Be aware that WebSphere Portlet Factory 6 only works with versions 5.1 and 6 of WebSphere Portal, and doesn't work with WebSphere Portal 5.0. If you're going to be developing for WebSphere Portal 5.0 -- which includes environments based on 5.0 -- like Workplace Services Express 2.5 -- you should use WPF 5.12.
Working through the tutorials that come with WebSphere Portlet Factory -- particularly '5. Using Domino Data in Portlets' – is a good place to start learning more about portalizing Domino applications.
There aren't really many other good resources for WPF at the moment. However, if you run into any difficulties, it might be worth browsing through the old Bowstreet forums.
Do you have comments on this tip? Let us know.
Related information from SearchDomino.com:
This tip was submitted to the SearchDomino.com tip library by member David Bowley. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.
This was first published in December 2006