Wiki
This website is a wiki. If you like and use our processes, techniques and tools, please add your experience and best practices. Just register and share.


Contents


User


Smart


Community

















The Tobago Templates are easy to understand text files. The text files are almost the same as the generated files. Simplicity is the goal.

The Tobago MDA Generator uses different mechanisms for generating code from templates.
  • Tobago Tags
  • Tobago Methods
  • Adaptive selection of templates
    ===Tobago Tags===

The Tobago MDA Generator replaces Tobago Tags according to the information of the selected pattern and classifiers. Tobago Tags are always surrounded by dollar-signs. For example Class.Name$ or $Attribute.Type$.



Tobago exposes an object model to the templates. This object model is used in the templates with a Tobago Tag. For the complete Tobago expose model choose the link on the left side of the page.

Tobago Methods

The syntax of the Tobago Methods is . For example <Tobago.Loop(Class.Attributes, Attributes)> or <Tobago.Marking(cancelcaption,Cancel)> or <Tobago.With(UseCase.Attributes, $Attribute.Type$)>























































Includecondition, truefolderIf the condition is true insert a new parsed template. The template is found in the template folder. There is no classifierscope change.
IncludefolderInsert a new parsed template. The template is found in the template folder.There is no classifierscope change.
Ifcondition, truestring, falsestringIf the condition is true insert the truestring in the template, otherwise insert the falsestring.
IfEmptystring, truestring, falsestringIf the string is empty insert the truestring in the template, otherwise insert the falsestring.
Loopclassifier list, template folder
for each classifier in the classifierlist insert a new parsed template. The template is found in the template folder. There is a classifierscope change.

Marking
marking name, alternative textInserts the value of the marking. If the marking doesn't exists in the markinglist the alternative is inserted.
Version-Inserts the version number. This number is set in the options dialog.
Withclassifier, template stringInsert a new parsed template string for the classifier.
Withclassifier list, template stringFor each classifier in the classifierlist insert a new parsed template string.
CurrentDate-Inserts the current date.
ProjectName-Inserts the name of the project.
Tagname of the tagged valueInserts the value of the TaggedValue entity in UML. Syntax <Tobago.Tag(tagname, emptyvalue)>.

Adaptive selection of templates

The Tobago MDA generator uses a adaptive selection of templates. With this mechanism is it possible to eliminate the complexity of the templates. The Tobago MDA generator searches for templates. If the templates doesn't exists the Tobago MDA Generator will search other templates and other locations.

The adaptive selection mechanism provides you a simple and efficient mechanism to specialize and extend the generation patterns.

The main template is the template with the same name as the pattern. The template is found in the following order:
  1. search the template in the project pattern folder;
  2. if the template is not found search the template in the Tobago patterns folder;
  3. if the template is not found use the Tobago default template.

For the sub templates the mechanism is the same, but more extended. The templates are found in the following order:

1. search the template in the project pattern folder or selected folder (selected by use of Tobago.Loop etc);

       1. first search the template by stereotype of the current classifier;

       2. if not found then search the template by type of the current classifier;

       3. if not found then search the template by stereotype of the type of the current classifier;

       4. if not found the search the default template;

2. if the template is not found search the template in the Tobago patterns folder;

       1. first search the template by stereotype of the current classifier;

       2. if not found then search the template by type of the current classifier;

       3. if not found then search the template by stereotype of the type of the current classifier;

       4. if not found the search the default template;

3. if the tempate is not found use the Tobago default template.

Cased string syntax

In the Tobago Expose model some attributes are typed as CasedString. A CasedString is a Tobago MDA Generator proprietary type. Each CasedString has the following methods.

  • Trim (removes all spaces, also spaces between words)
  • Plural (plural of the text in english)
  • Lower (lower cased text)
  • Upper (upper cased text)
  • Pascal (pascal cased text)
  • Camel (camel cased text)
  • Regular (the original text, this is also the default)