Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Extensibility through stereotype scripts and script items > Extending model item properties through stereotypes and tag definitions > Worked example of extending model item properties through profiles, stereotypes and tag definitions
  
Worked example of extending model item properties through profiles, stereotypes and tag definitions
In this example, we create a profile that contains two Stereotypes named Progress and Reusable:
The Progress Stereotype records whether an item is in progress or complete. The Progress Stereotype can be applied to any item.
The Reusable Stereotype records whether a Class maybe suitable for reuse. The Reusable Stereotype can be applied only to Classes.
After creating the profile, we apply it to the Filling Station model and then apply the Stereotypes to items in the Model.
To extend the model item properties through Profiles, Stereotypes and Tag Definitions, we carry out the following steps:
1. Create a model for profiles
2. Create the profile Package
3. Create the Stereotypes
4. Create the Tag Definitions
5. Publish the Tag Definitions
6. Link the Stereotypes to their Tag Definitions
7. Apply the profile to the Filling Station model
8. Apply the Progress Stereotype to all items
9. Set the Status tagged value (Progress Stereotype) of the Kiosk Controller Class to Complete
10. Apply the Reusable Stereotype to the Kiosk Controller Class
11. Set the Useful tagged value (Reusable Stereotype) of the Kiosk Controller Class to Maybe
1 Create a model for profiles
We start by creating a model to store all profiles. We name this model Profile Library.
2 Create the profile Package
In Modeler, a profile is a Package that contains the profile's Stereotypes and Tag Definitions.
We create a root Package for the profile and name it Progress and Reuse.
3 Create the Stereotypes
In the Progress and Reuse Package, we create two Stereotypes named Progress and Reusable. Creating a stereotype to extend model item properties
For the Progress Stereotype, we specify that all item types are valid.
For the Reusable Stereotype, we specify that only Classes are valid.
4 Create the Tag Definitions
In the Progress and Reuse Package, we create three Tag Definitions named Comments, Status and Useful. Creating a tag definition to extend model item properties
Comments is used by the Reusable Stereotype - it uses a Rich Text data type to record any comments.
Status is required by the Progress Stereotype - it uses an Enumeration data type to record the status of an item. It can be set to In Progress or Complete. The default value is In Progress.
Useful is required by the Reusable Stereotype - It uses an Enumeration data type to record whether a Class may be useful for reuse. It can be set to No, Maybe or Yes. The default value is No.
·5 Publish the Tag Definitions
We publish each Tag Definition, so that they can be applied to model items. For each Tag Definition, we click the Publish button on the Usage tab of its Property Pages.
6 Link the Stereotypes to their Tag Definitions
We link each Stereotype with the appropriate Tag Definitions. see: Creating a stereotype to extend model item properties.
We link the Progress Stereotype to the Status Tag Definition.
We link the Reusable Stereotype to the Useful and Comment Tag Definitions.
The Profile is now complete, and can be applied to a model.
7 Apply the profile to the Filling Station model
In this example we are not using a configuration management tool. We export the Progress and Reuse profile package to a directory by right-clicking the Package, pointing to Tools > Package Import/Export, and then clicking Export.
We open the Filling Station Model and import the exported Progress and Reuse profile Package to the Profiles package by right-clicking the Profiles package, pointing to Tools > Package Import/Export, and then clicking Import.
After adding the Progress and Reuse Package, its Stereotypes and Tag Definitions are available for use in the Filling Station model. We unprotect the Progress and Reuse profile package by clearing the Protected check box on the Access Permissions tab of the Progress and Reuse profile package's Property Pages.
8 Apply the Progress Stereotype to all items
We apply the Progress stereotype to all valid items in the Model by selecting the 'Apply to All Objects of Associated Model Item Types' check box on the Options tab of the Progress Stereotype's Property Pages.
9 Set the Status tagged value (Progress Stereotype) of the Kiosk Controller Class to Complete
The Kiosk Controller Class is complete, so we want to set its Status to Complete.
We open the Property Pages for the Kiosk Controller Class and notice that a Progress tab is now included for the linked Progress Stereotype. We set the Status property to Complete.
10 Apply the Reusable Stereotype to the Kiosk Controller Class
The Kiosk Controller Class maybe suitable for reuse, so we link it to the Reusable Stereotype by right-clicking the Kiosk Controller Class, pointing to Links > Stereotypes, and then clicking Reusable.
11 Set the Useful tagged value (Reusable Stereotype) of the Kiosk Controller Class to Maybe
We open the Kiosk Controller's Property Pages and notice that a Reusable tab is now included for the linked Reusable Stereotype. We set the Useful property to Maybe.
We have now used a Profile, Stereotypes and Tag Definitions to extend the properties of the Kiosk Controller Class.