Jump to: navigation, search

Tigerstripe Stereotypes Tutorial

< To: Tigerstripe_Tutorials

Stereotypes can be used to add additional information to a model element over and above that provided by default in Tigerstripe Workbench.

Stereotypes must be defined in the current profile before they can be used. This tutorial walks you through the definition of an Stereotypes named Persistence, its application to an Artifact, and how it can be used in a Plugin.


Before starting this tutorial, ensure that you are familiar with profile. For more information, refer to Tigerstripe_Profile_Tutorial.

Creating your Persistence Stereotype

Complete the following procedure to create a sample Stereotype.

To create a Persistence Stereotype:

  1. Click the Stereotypes tab in your profile.
  2. Name your Stereotype
    • For this example, name your Stereotype Persistence.
  3. Enter the version number for your Stereotype and enter a short description.
  4. Save your changes.

Defining the scope of your Persistence Stereotype.

Before you can use your Persistence stereotype in your project, you first need to define its scope. The scope defines the type of model element to which the stereotype can be applied. The scope can be defined as one of the follwoing elements:

  • Any Method - This means that the stereotype can be applied to any Method in any artifact in the model.
  • Any Attribute - This means that the stereotype can be applied to any Attribute in any artifact in the model.
  • Any Label - This means that the stereotype can be applied to any Attribute in any artifact in the model.
  • Any Argument - This means that the stereotype can be applied to any Argument of any Method in any artifact in the model.

In addition the stereotype can be applied to Artifacts of specific types.

IMPORTANT NOTE: The inclusion of an Artifact Type (eg Managed Entity) and another qualifier (eg Any Method) does not mean that an stereotype can only be applied to methods of Managed Entities. What it does mean is that the stereotype can be applied to any Method on any Artifact, AND it can also be applied to Managed Entity Artifacts (at the artifact level).

To define the scope for your Persistence stereotype:

  1. In the Stereotypes tab, select the Persistence stereotype and locate the Scope section.
  2. Select the scope you want to define with your stereotype or leave the option unselected if you want to exclude that option from your stereotype.
    • For this example, select ManagedEntity Artifact.
  3. Save your profile.

Defining attributes for your Persistence stereotype.

After you define the scope of your Persistence stereotype, you may define one or more Stereotype attributes. Stereotype attributes are additional fields that appear on your stereotype when applied to a model element within a Tigerstripe Project - the Stereotype attributes can take a value that is chosen by the user. Note that stereotypes do not require Stereotype attributes - you can use stereotypes without any Stereotype attributes, simply by applying them to model elements and making their presence (rather than value) of significance.

You can include the following Stereotype attributes types:

  • String - Allows you to create a text field in which the user must enter information.
  • Option - Allows you to create a checkbox which the user may select true or false values.
  • List - Allows you to create a list of options from which the user must select.

Complete the following procedure to define Stereotype attributes for your Persistence stereotype.

To define attributes:

  1. In the Stereotypes tab, select the Persistence stereotype and locate the Attributes section.
  2. Click Add. The Stereotype Attribute Edit' dialog box opens.
  3. Enter a name for your stereotype attribute.
    • For this example, create an attribute named isPersistent.
  4. Enter a short description for your stereotype attribute and select Checkable Attribute.
    • Note: In this example, isPersistent will be an attribute for which the user must enable or disable.
  5. Click OK to save your stereotype attribute definition.
  6. Save your profile.

To complete this example, create two more attributes:

  • tableName - This attribute is a String Type Attribute with the default value of tableName.
  • storageType - This attribute is a Selection List Attribute with the following selections:
    • anEntry0
    • anEntry1 - Set this option as the default selection by clicking Set default.
    • anEntry2

When you are finished, your Stereotype Definitions in your project profile should include the following:

  • Stereotype named Persistence.

You must now Deploy the profile. For more information about deploying a profile, refer to the Tigerstripe_Profile_Tutorial.


Adding stereotypes to an entity.

Complete the following procedure to add the Persistence stereotype to an entity in your Tigerstripe Project.

To add a simple stereotype:

  1. In the Overview tab for your entity, locate the Stereotypes section. You may need to click on the title Stereotypes to open the list.
  2. Select Add. The Stereotype Selection dialog box displays.
  3. Select an stereotype from the list of stereotypes and click OK.
    • In this example, select the Persistence stereotype.

To edit an stereotype:

  1. Double-click the stereotype in the Stereotypes section of your entity. Alternatively, select the stereotype and click Edit. The Stereotype Details dialog box opens.
  2. Enter the stereotype name in the tableName text box.
  3. Select isPersistent. In this example, this option is selected by default as defined in the Entity Stereotypes tutorial.
  4. Make a storage selection from the storageType list box. As defined earlier,anEntity1 is the default selection.
  5. Click OK to save your changes and return to the entity editor.
  6. Save your entity.