Templates are used to manage the distribution of database designs. There are essentially two types of templatesdatabase templates and master design templates. Database templates are used to create or replace the design of a database application. Master design templates, on the other hand, can be used to refresh the design of the database and can be configured to automatically propagate (through a process called "Inherit Design") database design changes. As a Notes database developer, youll probably utilize both template types and distribution approaches to control changes to database applications. Lets take a look at each template in greater detail.
The first type of template is typically referred to as a database template and can be readily identified by the .NTF file extensionwhich stands for Notes Template Facility. This type of template allows users to create a new database or replace the design of an existing database using the Lotus Notes client.
For example, when creating a new database, a list of available design templates is displayed in the New Database dialog window. These templates can be used as the basis for a new databasea starting point, in other words. The list of available templates is displayed in the Template section of the window (see Figure 20.1).
The Lotus Notes client application includes a number of standard design templates that can be used to create new database applications. A standard set of design templates automatically displays in the New Database dialog box. They include
Additional templates are also available by selecting the Show advance templates option. This will expand the list of templates to include other database design templates.
Database templates can be created both from scratch (just like creating a database) and by copying the design of an existing one and changing the file extension from .NSF to .NTF. Both approaches are described in the next two sections.
When creating a template based on an existing database or template, always copy the database using one of the Lotus Notes clients. Do not copy and rename database applications at the operating system level. Each database contains a unique database identifier called a Replica ID. Copying the database from the operating system environment will cause undesirable effects on the design of the existing database and the documents in that database. Because both databases have the same Replica ID, changes made to one database will be replicated to the other database.
To create a new database template, perform the following steps.
Open the Domino Designer client and select the File > Database > New menu options (or click the Create a new database button from the default workspace screen).
Specify the server location and title of the database (see Figure 20.2).
Figure 20.2. New Database dialog
Consider adding a version number to the title. This will enable you and other users to easily determine the level of code associated with a particular template design. You may want to make a new template when major changes are applied to the database. This way you can replace the database with a prior version if needed.
Next, change the file name extension. Replace the .nsf file extension with .ntf to establish the database as a template and click OK to generate the database.
Modify the design as needed. When the updates are complete, it can be used as the basis for a new database or to refresh or replace the design of an existing database (as described later in this chapter).
To create a template based on an existing database, complete the following steps.
Locate the database in the Lotus Notes client and select the File > Database > New copy menu options. This will display the Copy Database dialog window.
Similar to the previous approach, specify a title and file name for the template. Consider including a software version number in the title name for reference purposes.
Change the file name extension by removing the .nsf tag and appending the .ntf extension to the file name. This will signify to Lotus Notes that the database is a template.
Select a copy parameter. In most cases, youll want to change the What to Copy parameter to Database design only. This will copy only the database design elements and no documents. However, if the database design depends on specific documents to manage the functionality of the database, you will need to manually copy those documents over. Alternatively, you could select the Database design and documents option and remove the extraneous documents afterward. Be aware that this second approach could result in a very large database. Also note that any document that is stored in the template will be copied into the design when the template is used to create a new database. This is beneficial for databases that depend on certain documents for configuration and functionality.
Uncheck the Access Control List option. By deselecting this option, the ACL for the template will be reset, and you will be assigned Manager access to the database. Select this option only if you want to keep existing ACL settings for the database. Just be aware that the ACL settings for the template database will match those set in the original database and could affect your ability to change design elements and database documents.
Click the OK button to generate the template.
After the database has been created, be sure to review and disable scheduled agents. The template is now ready for use. If the template was created on the "Local" workstation, only people who use that workstation (probably just yourself) will be able to see and utilize the template. If the template was created on a Domino server, be sure to set the ACL such that users can access the template. In most cases, youll probably want to set the default access level to Reader.
The second type of templates, master design templates, are used to manage incremental enhancements to the database and automatic propagation of design changes across one or more database applications. Using a master design template, you can make changes to a database, verify that the enhancements work as intended, and have them reviewed by the customer prior to applying them to the live production database application.
This approach is easy to implement and offers tremendous benefits for managing changes to the production database. In fact, master templates can be considered the foundation for a Domino application development environment. This approach can be used to isolate changes, track software versions, and roll back changes should you need to revert to a previous version.
So what is a master template? In the simplest terms, it is a database property that enables Domino design elements from one Notes database to be transferred to another Notes database, which is accomplished in two steps. First, you define one database as the master design, and then you associate one or more databases to inherit the design (see Figure 20.3).
Virtually any database at any point in time can be established as a master design template. As with many configuration settings, the master template is defined through the database properties dialog window. This is accomplished by setting the Database is a master template property on the source database and the Inherit design from master template property on the target database.
After these two database properties are set, design changes can be initiated manually or transferred automatically by the Domino server on a scheduled time interval.
Another advantage to this approach, as implied previously, is that it allows multiple databases to be updated from a common (or central) design. Lets say you have multiple discussion forums. Although each forum is used for a separate discussion thread, the underlying design of the database remains the same. Using the master design template, you can change the design once and apply the changes to all related databases (see Figure 20.4).
By default, the Domino server automatically updates (or distributes) design changes at 1:00 a.m. each morning. Ensure that all design changes are complete by the end of day to ensure that partial design changes are not prematurely distributed. Alternatively, deselect Inherit design from master database for all databases. This will prevent unfinished designs from being rolled into production.
To ensure that changes to the master template are automatically applied to the target databases, be sure that all databases are located on the same Domino server as the master template database.
The following outlines the two-part process for creating and using master design templates.
To create a master design template, perform the following steps.
Locate the database to be used as the master design in the Lotus Notes client.
Select the File > Database Properties menu options. Switch to tab 4 to set the property values as illustrated in Figure 20.5.
Figure 20.5. Set the master database template name for a database
Select the option Database file is a master template and specify a unique Template name text tag.
In general, the master template name, as set in the database properties dialog, should be a unique value for each database. Using the same value as the master template name can cause unpredictable results. Lotus Notes will also display warning messages when attempting to refresh the database design because more than one database is considered to be the master design. To reduce potential problems and confusion, ensure that each master template has a unique template name.
After a master design template has been established, it can be associated with one or more databases. Complete the following steps to associate the design with a database.
Locate the database to be used as the master design in the Lotus Notes client.
Select the File > Database Properties menu options and switch to tab 4 to set the property values.
Select the Inherit design from master template option and set the template name in the database properties dialog (see Figure 20.6). Be sure that the template name exactly matches the master template (as outlined in the previous section).
Configuration is now complete. Design changes will be applied as defined by the Domino server configuration settings. Alternatively, you can manually force a database design refresh by selecting either the File > Database > Refresh Design or Replace Design menu options.
An Introduction to the Lotus Domino Tool Suite
Getting Started with Designer
Navigating the Domino Designer Workspace
Domino Design Elements
An Introduction to Formula Language
An Introduction to LotusScript
Fundamentals of a Notes Application
Reference Library Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
Miscellaneous Enhancements and Tips for Domino Databases
Application Deployment and Maintenance
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
Authors: Mark Elliott