Chapter 4 Extending your Models with Profiles
Extended Collections and Compositions (Profile)
An extended collection allows you to associate multiple instances of one metaclass with an instance of another.
For example, to attach documents containing use case specifications to the different packages of a model you can create an extended collection in the Package metaclass and define FileObject as the target metaclass. You could create an extended collection on the OOM process metaclass to show the components used as resources to the process, in order to have a more accurate vision of the physical implementation of the process.
The association between the parent and child objects is relatively weak, so that:
- If you copy and paste an object with extended collections, the related objects are not copied.
- If you move an object with extended collections, the link with the related objects is preserved (using shortcuts if required).
An extended composition allows you to associate multiple instances of the extended sub-object metaclass with a metaclass. The association is stronger than that created by an extended collection – sub-objects can only be created within the parent object and are moved, copied, and/or deleted along with their parent.
When you create an extended collection or extended composition in a metaclass, a new tab with the name of the collection or composition is added to the metaclass property sheet.
Creating collections/compositions on stereotypes/criteria
If you create an extended collection or composition on a stereotype or criterion, the corresponding tab is displayed only if the metaclass instance bears the stereotype or meets the criterion.
For extended collections, the property sheets of the objects contained within the collection list the parent object on their Dependencies tab.
To create an extended collection:
- Right-click a metaclass, stereotype, or criterion and select New→Extended Collection.
- Enter a name in the Name box. This name will be used as the name of the related tab in the object property sheet.
- [optional] Enter a comment and an inverse name.
- Select a metaclass in the Target Type list to specify the kind of object that will be contained in the collection.
- [optional] Select or enter a stereotype to further refine the instances of the target metaclass that may appear in the collection. Click the Create tool to the right of this field to create a new stereotype.
- Click Apply or OK to save your changes and return to your model.
You can view the tab associated with the collection by opening the property sheet of a metaclass instance. The tab contains Add Objects and Create an Object tools, which allow you to populate the collection.
To create an extended composition:
- Right-click a metaclass, stereotype, or criterion and select New→Extended Composition.
- Enter a name in the Name box. This name will be used as the name of the related tab in the object property sheet.
- [optional] Enter a comment.
- Select or enter a stereotype to further refine the instances of the target metaclass that may appear in the collection. Click the Create tool to the right of this field to create a new stereotype.
- Click Apply or OK to save your changes and return to your model.
You can view the tab associated with the composition by opening the property sheet of a metaclass instance. The tab contains Add and Insert Row, and Add Objects and Create an Object tools, which allow you to populate the composition.
Copyright (C) 2008. Sybase Inc. All rights reserved.
|
|