Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Tigerstripe Stereotypes Tutorial"

 
(3 intermediate revisions by one other user not shown)
Line 14: Line 14:
 
To create a Persistence Stereotype:
 
To create a Persistence Stereotype:
  
# '''Click''' the '''Annotations''' tab in your '''[[Tigerstripe_Glossary#Profile|profile]]'''.
+
# '''Click''' the '''Stereotypes''' tab in your '''[[Tigerstripe_Glossary#Profile|profile]]'''.
 
# Name your Stereotype
 
# Name your Stereotype
 
#* For this example, name your Stereotype Persistence.
 
#* For this example, name your Stereotype Persistence.
 
# Enter the version number for your Stereotype and enter a short description.
 
# Enter the version number for your Stereotype and enter a short description.
 
# '''Save''' your changes.
 
# '''Save''' your changes.
 
  
 
=Defining the scope of your ''Persistence'' Stereotype.=
 
=Defining the scope of your ''Persistence'' Stereotype.=
Line 30: Line 29:
 
* '''Any Argument''' - This means that the '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can be applied to '''any''' Argument of '''any''' Method in '''any''' artifact in the model.
 
* '''Any Argument''' - This means that the '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can be applied to '''any''' Argument of '''any''' Method in '''any''' artifact in the model.
  
In addition the '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can be applied to Artifacts ofs pecific type.
+
In addition the '''[[Tigerstripe_Glossary#Stereotype|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 '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can only be applied to methods of Managed Entities. What it '''does''' mean is that the '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can be applied to '''any''' Method on '''any Artifact, '''AND''' it can also be applied to Managed Entity Artifacts (at the artifact level).
 
'''IMPORTANT NOTE:''' The inclusion of an Artifact Type (eg Managed Entity) and another qualifier (eg Any Method) '''does not''' mean that an '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can only be applied to methods of Managed Entities. What it '''does''' mean is that the '''[[Tigerstripe_Glossary#Stereotype|stereotype]]''' can be applied to '''any''' Method on '''any Artifact, '''AND''' it can also be applied to Managed Entity Artifacts (at the artifact level).
Line 51: Line 50:
 
* List - Allows you to create a list of options from which the user must select.
 
* List - Allows you to create a list of options from which the user must select.
  
Complete the following procedure to define '''[[Tigerstripe_Glossary#Stereotype Attribute|Annotation attributes]]''' for your ''Persistence'' '''[[Tigerstripe_Glossary#Annotation|annotation]]'''.
+
Complete the following procedure to define '''[[Tigerstripe_Glossary#Stereotype Attribute|Stereotype attributes]]''' for your ''Persistence'' '''[[Tigerstripe_Glossary#Stereotype|stereotype]]'''.
  
 
To define attributes:
 
To define attributes:
  
# In the '''Annotations''' tab, select the ''Persistence'' annotation and locate the '''Attributes''' section.
+
# In the '''Stereotypes''' tab, select the ''Persistence'' stereotype and locate the '''Attributes''' section.
# Click '''Add''. The '''Annotation Attribute Edit''' dialog box opens.
+
# Click '''Add''. The '''Stereotype Attribute Edit''' dialog box opens.
# Enter a name for your '''[[Tigerstripe_Glossary#Annotation Attribute|annotation attribute]]'''.
+
# Enter a name for your '''[[Tigerstripe_Glossary#Stereotype Attribute|stereotype attribute]]'''.
 
#* For this example, create an attribute named ''isPersistent''.
 
#* For this example, create an attribute named ''isPersistent''.
# Enter a short description for your '''[[Tigerstripe_Glossary#Annotation Attribute|annotation attribute]]''' and select '''Checkable Attribute'''.
+
# Enter a short description for your '''[[Tigerstripe_Glossary#Stereotype Attribute|stereotype attribute]]''' and select '''Checkable Attribute'''.
 
#*    Note: In this example, ''isPersistent'' will be an attribute for which the user must enable or disable.
 
#*    Note: In this example, ''isPersistent'' will be an attribute for which the user must enable or disable.
# Click '''OK''' to save your '''[[Tigerstripe_Glossary#Annotation Attribute|annotation attribute]]''' definition.
+
# Click '''OK''' to save your '''[[Tigerstripe_Glossary#Stereotype Attribute|stereotype attribute]]''' definition.
 
# '''Save''' your profile.  
 
# '''Save''' your profile.  
 
To complete this example, create two more attributes:
 
To complete this example, create two more attributes:
Line 72: Line 71:
 
** anEntry2
 
** anEntry2
  
When you are finished, your Annotation Definitions in your project profile should include the following:
+
When you are finished, your Stereotype Definitions in your project profile should include the following:
  
* Annotation named Persistence.
+
* Stereotype named Persistence.
 
** '''Scope''' of ''Managed Entity''.
 
** '''Scope''' of ''Managed Entity''.
** Three '''[[Tigerstripe_Glossary#Annotation Attribute|annotation attributes]]''': ''isPersistent'', ''tableName'', ''storageType''.
+
** Three '''[[Tigerstripe_Glossary#Stereotype Attribute|stereotype attributes]]''': ''isPersistent'', ''tableName'', ''storageType''.
  
 
You must now '''Deploy''' the profile. For more information about deploying a profile, refer to the '''[[Tigerstripe_Profile_Tutorial]]'''.
 
You must now '''Deploy''' the profile. For more information about deploying a profile, refer to the '''[[Tigerstripe_Profile_Tutorial]]'''.
  
  
=Adding annotations to an entity.=
+
=Adding stereotypes to an entity.=
  
Complete the following procedure to add the ''Persistence'' annotation to an entity in your '''[[Tigerstripe_Glossary#Tigerstripe Project|Tigerstripe Project]]'''.
+
Complete the following procedure to add the ''Persistence'' stereotype to an entity in your '''[[Tigerstripe_Glossary#Tigerstripe Project|Tigerstripe Project]]'''.
  
To add a simple annotation:
+
To add a simple stereotype:
  
# In the '''Overview''' tab for your entity, locate the '''Annotations''' section. You may need to click on the title '''Annotations''' to open the list.
+
# In the '''Overview''' tab for your entity, locate the '''Stereotypes''' section. You may need to click on the title '''Stereotypes''' to open the list.
 
# Select '''Add'''. The '''Stereotype Selection''' dialog box displays.
 
# Select '''Add'''. The '''Stereotype Selection''' dialog box displays.
# Select an annotation from the list of annotations and click ''OK''.
+
# Select an stereotype from the list of stereotypes and click ''OK''.
#*    In this example, select the ''Persistence'' annotation.
+
#*    In this example, select the ''Persistence'' stereotype.
  
To edit an annotation:
+
To edit an stereotype:
  
# Double-click the annotation in the '''Annotations''' section of your entity. Alternatively, select the annotation and click '''Edit'''. The '''Annotation Details''' dialog box opens.
+
# Double-click the stereotype in the '''Stereotypes''' section of your entity. Alternatively, select the stereotype and click '''Edit'''. The '''Stereotype Details''' dialog box opens.
# Enter the annotation name in the ''tableName'' text box.
+
# Enter the stereotype name in the ''tableName'' text box.
# Select ''isPersistent''. In this example, this option is selected by default as defined in the Entity Annotations tutorial.
+
# Select ''isPersistent''. In this example, this option is selected by default as defined in the Entity Stereotypes tutorial.
 
# Make a storage selection from the ''storageType'' list box. As defined earlier,''anEntity1'' is the default selection.
 
# Make a storage selection from the ''storageType'' list box. As defined earlier,''anEntity1'' is the default selection.
 
# Click '''OK''' to save your changes and return to the entity editor.
 
# Click '''OK''' to save your changes and return to the entity editor.
Line 102: Line 101:
  
  
=Using Annotations from a plugin=
+
<!--  Bug 322410 -  [Documentation] Fix up Tigerstripe documentations
 +
=Using Stereotypes from a plugin=
  
 
To be completed
 
To be completed
 +
-->

Latest revision as of 14:17, 30 August 2010

< 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.


Back to the top