Setup Static Metadata Pages - SuperWEB2
You can add metadata about databases, tables, and fields within tables to SuperWEB2. Once the metadata is set up, end users can click the links in the SuperWEB2 interface to read the additional information about the data they are working with.
Metadata links are available in SuperWEB2's Table View mode, for any fields that have been added to the table. The links are denoted by the icon:
This page describes how to set up metadata for SuperWEB2 using static HTML pages.
It is also possible to store metadata in a database, instead of using static HTML pages. See Setup a Metadata Database - SuperWEB2 for more information.
To set up static HTML metadata you need to complete the following steps:
Step 1 - Create Directory Structure for Metadata Files
Create a directory to store the metadata files.
This directory can be anywhere on the server file system, but is best located within the Tomcat context for the SuperWEB2 application. For example, you might create <tomcat_home>\webapps\webapi\help\metadata
Within this directory, create a sub-directory for each database, with the same name as the database ID.
For example, if you have database called Retail Banking, with the ID bank and a database called People with the ID people, you would create the following directories:
You can find out the ID of a database by logging into SuperADMIN and typing the command cat databases
Step 2 - Build HTML Files for Each Metadata Link
Create an HTML file for each metadata link and save it to the directory structure you created in the previous step, using a filename that matches the element name.
For example:
Database ID | Element Name | Required File Location |
---|---|---|
bank | (metadata file for the whole database) | <tomcat_home>\webapps\webapi\help\metadata\bank\bank.html |
bank | Age | <tomcat_home>\webapps\webapi\help\metadata\bank\Age.html |
bank | Marital Status | <tomcat_home>\webapps\webapi\help\metadata\bank\Marital Status.html |
people | (metadata file for the whole database) | <tomcat_home>\webapps\webapi\help\metadata\people\people.html |
people | Gender | <tomcat_home>\webapps\webapi\help\metadata\people\Gender.html |
The HTML file can use any valid HTML construct, including images and external link references.
If you need to display characters such as £ or €, make sure you save the HTML file in UTF-8 format.
Important: Make Sure You Create an HTML file for Every Field
You must create an HTML page for every field, even if there is no information for some fields. This page could simply advise that no metadata is available.
Once you have enabled metadata on the server, if there is no matching HTML page located in the metadata directory for a particular field, then clicking the metadata link will show a default Tomcat error page:
Step 3 - Configure SuperWEB2 to Link to the HTML Files
The final step is to configure SuperWEB2 to link to the HTML files. To make this change, you need to edit the file <tomcat_home>\webapps\webapi\help\not-configured.jsp
Make a backup copy of this file before making any changes.
Open the file in a text editor and add the following code at the start of the file:
<%
String databaseID = request.getParameter("dbid");
String componentName = request.getParameter("metaInfoComponentName");
String redirect_FIELD = "/webapi/help/metadata/" + databaseID + "/" + componentName + ".html";
String redirect_TABLE = "/webapi/help/metadata/" + databaseID + "/" + databaseID + ".html";
if (componentName != null) {
response.sendRedirect(redirect_FIELD) ;
}
else response.sendRedirect(redirect_TABLE) ;
%>
Note that this code assumes that you have saved the metadata HTML files to <tomcat_home>\webapps\webapi\help\metadata\ as described above. If you have saved your files to a different location, you will need to change the path for the string redirect accordingly.
Once you have made the changes, save the file and restart Tomcat (or the SuperWEB2 Service if using our SuperSTAR Suite), then open SuperWEB2 to verify your changes.