The variables imported to the template are collected by the type of element selected in the package scope. Use the fourth step in the Report Wizard dialog to select the package scope. In this example, we take a class diagram with the class name Customer, see the figure below, to print it in a report.


Class Diagram: Customer.

To print attributes of the Customer class in a report


  • Right-click the Customer class diagram and open the Specification dialog. The element type will appear on the dialog title, and the attribute names will appear on the right-hand side of the dialog box (see the following figure).
Specification Dialog
The Specification dialog.

With the following VTL code, you can print the attributes of the Class element:

#foreach ($class in $Class)
   Name: $class.name
   Owner:  $class.owner.name
   Visibility: $class.visibility
   Is Abstract: $class.isAbstract
#end

The output will be as follows:

Name: Customer
Owner:  com
Visibility: public
Is Abstract: false

 

The table below gives and explains the additional properties which are not part of the UML specifications, but retrievable by Report Wizard.

Element Owner Property Name Function 
 DiagramimageTo return the diagram’s image.
 DiagramdiagramTypeTo return the diagram’s type.
 ElementimageTo generate the element’s image
or to print an empty text if the
element does not refer to any
diagram.
 ElementelementType

To return a name of an element’s type
(metaclass / stereotype) in lowercase
letters and without spaces. For example:

  • return "usecase" for a Use Case
  • return "class" for a Class
  • return "callbehavioraction" for a
    Call Behavior Action
  • return "flowport" for a Flow Port
    (a stereotype defined in SysML)
 ElementhumanNameTo return an element’s human readable
name, which is a string concatenation
between the human element type and
the element’s name.
 ElementhumanTypeTo return an element’s type in a
human readable format.
 Element appliedStereotype To return an applied stereotype
of an element.
 Element activeHyperlink To return an active hyperlink
of an element.
 Element hyperlinks To return all hyperlinks
attached to an element.
 Element toDo To return an element’s
ToDo attribute in text format.
 Element elementID To return an element’s ID.
ElementdocumentationTo return an element’s
comment/documentation.
Element presentationElement To return a
presentation element.
ElementtypeModifier To return an element’s
type modifier.
Element tagsTo return a list of element
tags.
Elementtext 

To return a text representation
of an element. In general, a 'text'
property returns a string which
“textually represents” the element.
The string may vary depending on
the symbol properties and environment
options. This property returns the result
from OpenAPI.

RepresentationTextCreator.getRepresentedText(Element element)
ElementslotsTo return a list of element’s slots.
ElementelementURLTo return an element’s URL.
ClassifierbaseClassifierTo return a base classifier of an element.
BehavioredClassifierrealizedInterfaceTo return a Classifier’s Realized Interface.
PackageappliedProfileTo return a list of profiles applied to a package.
StereotypemetaClassTo return a Meta Class of a stereotype.
DurationConstraintminTo return a minimum value of the Duration Constraint.
DurationConstraintmaxTo return a maximum value of the Duration Constraint.
TimeConstraintminTo return a minimum value of the Time Constraint.
TimeConstraintmaxTo return a maximum value of the Time Constraint.
MultiplicityElementmultiplicityTo return a multiplicity value.
PropertynavigableTo return a navigable value.
PropertyownedByTo return a property’s owner.
Lifelinetype To return a lifeline type.
Messageevent To return a message event.
MessageoperationTo return a message operation.
MessagesignalTo return a message signal.
Message numberTo return a message number.
Trigger eventType To trigger an event type.
RequirementsUseCasenumber To return a use case number.

Some predefined variables, which are not part of the UML specifications, are usable in the templates:

  • $elements
    contains a list of all the elements selected from the element scope.
  • $packageScope
    contains a selected package from the element scope.
  • $elementScope
    contains selected elements from the element scope.
  • $empty
    contains a String for empty value, which is specified from the Output Options pane.
     

humanName and humanType are locale-specific text. If you plan to generate a report in different languages, try to avoid humanType and humanName. Instead, use elementType for a non-locale-specific report.