An application is composed of several pieces. There is the user interface, which is the part the end user interacts with. Then there is the raw data; the substance of what the application is tracking. Between these is the business logic. It defines the
operations to perform on the data when the user conducts a certain operation through the user interface, or how to present interpretations of that data to the user.
Most Notes applications encode this business logic in number of places. It can be on forms, in agents, script libraries, action bars, and many other places. They may even reside outside of the application altogether in a service called remotely. Adding an XPage front end to an existing Notes application allows you to present a new, web-based user interface to the users. However it still has to interact with the back end data in the same way that your previous user interface did. To minimize the amount of work done in creating this new interface, it is desirable to re-use as much of that business logic as possible.
In some cases, your existing business logic will automatically be called. For
dominoDocument datasources on an XPage that are bound to an underlying
Form with
validation logic, the
computeWithForm property can be set to trigger this logic. This can be triggered on onLoad, onSave, or onBoth for that
dominoDocument. But in other cases, such as an action on an action bar that's been attached to a view or form, there is no XPage equivalent.
Here are some techniques you can use to leverage your existing business logic investment with a new Xpage front end.
It's worth stating that the assumption we've made so far is that you have a strong investment in existing, complicated business logic. The above methods can expose that logic, but in most cases there is a price in performance. Depending on the load on your application, this can vary between inconsequential, and considerable.
The final option, in all cases, is to re-write your business logic in a form that can be directly called by XPages: Javascript. If your business logic is, in fact, small snippets or a single library, it is something to consider as an option.
Conclusion
A new user interface layer will be needed when developing an applications with XPages and one of the benefits of XPages is the ability to access your Lotus Domino data. This article focuses on the business logic which connects your user interface to the application data. In some cases you will develop totally new applications and business logic in JavaScript or recreate your business logic in JavaScript. In other cases, you will want to reuse your existing logic. Three techniques are described above which you can use to leverage your existing business logic investment. One option is best suited for LotusScript using an agent. Another option reuses your Java investment by packaging the business logic to be available from XPages. The last option leverages Web services to access logic from an external application. Select the best option to maximize your reuse while minimizing additional work.