Creating a template with the Rational Tau sample data

Rational® Tau sample data is provided in the Rational Publishing Engine installation, which you can use to generate a Rational Tau template and report.

You can find the Rational Tau sample data file used in this topic in %RPE_HOME%\source\Tau\schema.

You can find the finished template that this topic helps you to create in %RPE_HOME%\source\Tau\examples\Tutorial_Tau.dta.

Basic setup

Create a document template, add the packages, and for each package list the classes and the diagrams that are contained in that package. For each class, a table is added that lists the class's attribute names and types. If the "TAU instalation Path\bin" is not installed to the path in the system variable, the following error displays "Cannot Initialize JAVA API" Error on document generation.

1. Creating a document template

A document template defines what data is to be extracted from the data source (queries) and how to format all the information (formatting information).

A template is built of static and dynamic content. The static content is defined by data such as texts and images, that are provided when the template is designed. The dynamic content is represented by data obtained from the data sources at document generation time. A document template does not refer to concrete data sources.

The template's data's structure is defined with a schema. This allows the template to be applied to any data source that has a matching structure.

To create a template:

  1. In the Document Studio, click File > New > New Template Wizard and click Next in the welcome page.
  2. Click Create a New Template and click Next.
  3. Select Define Template Title Page and then click the check box next to the options to select the paragraph elements containing a Title, Subtitle, along with Table and Section fields to be included in the Template and then click Next.
  4. In the Summary window, review the information and click Finish.

2. Adding data source schema

Templates operate with data schemas and not with actual data sources. You can add new data source schema to the currently open template.

To add a data source:

  1. You can add new schemas in three ways.
    • In Document Studio, click Data > Add Data Source Schema.
    • In the Outline view, click Data Source Schemas > Insert > Data Source Schema.
    • In the Schema view, click Add Data Source Schema icon
  2. In the Add Data Source Wizard, click Next in the welcome page.
  3. Select a New Data Source Schema:
    1. In the Schema type field, select the type of the schema from the list (for example, Tau).
    2. In the Schema file field, type or click Browse to select the path for the schema file. You need to provide the full path to the schema. The schema can be on the local file system or on any URL accessible from the computer.
    3. In the Data Source ID field, type the name for the data source. For example, Tau 1. Add Data Source Schema Wizard
    4. In the Summary window, review the information and click Finish.

3. Defining template contents

To define a template contents:
  1. Define a query for the top-level packages and cast under the model.root element:
    • Click the root(Any Type) element from the Data Source Schema view and click Cast to Type icon.
      Defining a query
    • In the Select Type window, select Package and then click OK.
    Note: You cannot build queries of type Any Type. A cast needs to be defined before using the query. Schema elements that can have more than one type do not have a type assigned to them. In such cases, you can define which type to use through the Cast to type feature.
  2. Add the container element from the Palette view in the template, and drag the newly added Package element from the Data Source Schema view to the container element.
  3. Name the container Root Packages for easier referencing.
  4. Create a paragraph in the container element and add the Name attribute. Name attribute in the paragraph element.
  5. Add the static text heading diagrams for the list of diagrams:
    • Add the Paragraph element from the Palette view to the container element.
    • Add the Text element from the Palette view to the paragraph.
    • Double-click the text and set the value for the diagrams.
    • Create a new container in the Root Packages container and add the package diagram element to it.
      Note: To add a specific diagram type, add a cast to that diagram type below the diagram(Diagram) node and use the cast type instead of the generic diagram type.
    • To add a specific diagram:
      • Add an image element from the Palette view into the container.
      • Right-click on image element and select Set Value.
      • In the Set Value for Image Element window, expand $2 - model.root(Package).diagram, and select _image. The selected attribute is added in the Select data item field.
      • Click OK.
        Set Value for Image Element
    • Add a Paragraph element below the Image element by dragging the element from the Palette view.
    • Add the Diagram caption element to the paragraph by dragging the element from the Palette view. Optionally, add a figure caption field so that you can build a Table of Figures.
      Tip: You can also add diagram name to the figure caption.
      Adding diagram caption
    • To display the figure caption with the diagram name:
      • In the Properties view, expand specific, and then click Setting field value.
      • In the Set Field Label Value window, expand $2- model.root(Package).diagram, and select Name. The selected attribute is added in the Select data item field.
      • Click OK.
  6. List the classes from each package:
    • Add a Paragraph element from the Palette view, and then add the static text element to it for the class list.
    • Add a Container element below the Paragraph element, and then add the ownedMember class from the Data Source Schema view to this container. Name the container as Class Container for easier reference.
    • Add the Class type cast for the ownedMember by clicking the Cast to Type icon icon. Adding a class type cast
    • Add a Paragraph element below the Container element, and add the name of the package inside the Class Container by dragging the Name(string) attribute. Adding a Package Name
      Note: You can add this text only for the active classes by setting a condition to the text element.
    • To add a text only to the active classes:
      • Add a new text element, and set its content to the static text (Active) by dragging the attribute from the Data Source Schema view.
      • Right-click the Text element and click Data > Edit Condition.
      • In the Set Condition for Current Element window, expand Attributes, and then click the check box for the IsActive attribute. The selected attribute is added to the Left operand field in the right pane.
      • In the right pane, select the Operator as Equals from the list.
      • Select the Right Operand as true from the list.
      • Click OK.
  7. Save the document.

4. Generating the document

Switch to the Launcher perspective. If the perspective icon is not visible under the toolbar, click the button located in the top left part of the screen, below the toolbar.

Note: When the keep document specification synchronized preference is selected, the document specification is synchronized with the edited template at every load, close, and save operation. If the preference is not selected, you must manually synchronize the document specification.

To configure the data source:

  1. In the Document Specification window, expand Templates > Data Sources.
  2. Right-click the data source and then click Configure Data Source.
  3. In the Select a Tau Project File window, select a Tau project. For example, CMdesign.ttp.
  4. Click Open.
    Selecting the Tau Data Source
  5. Once you have configured the data source, generate the document by clicking Publish > Generate Document or by clicking Generate Document icon icon.

After you generate the document, the output contains the name of the top-level packages in the model, the diagrams, and the classes in each package.


Feedback