Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Mastering UML with Rational Rose 2002.pdf
Скачиваний:
137
Добавлен:
02.05.2014
Размер:
9.68 Mб
Скачать

Chapter 4: Use Cases and Actors

Select Specification from the shortcut menu.

3.

The relationship specification window will appear. (See the upcoming "Working with Relationships" section for a detailed description of relationship specifications.)

To delete a relationship:

1.

Right−click the relationship in the list.

2.

Select Delete from the shortcut menu.

Viewing an Actor's Instances

As you are modeling the system, you may want to know on which Sequence and Collaboration diagrams a particular actor resides. Rose provides this ability through the Report menu.

To view all Sequence and Collaboration diagrams containing the actor:

1.

Select the actor on a Use Case diagram.

2.

Select Report → Show Instances.

3.

Rose will display a list of all Sequence and Collaboration diagrams that contain the actor. To open a diagram, double−click it in the list box or press the Browse button.

Working with Relationships

UML supports several types of relationships for use cases and actors. These include association relationships, includes relationships, extends relationships, and generalization relationships. Association relationships describe the relationships between the actors and the use cases. Includes and extends relationships describe the relationships between the use cases. Generalization relationships describe inheritance relationships among use cases or actors.

Association Relationship

An association relationship, as we discussed in the "Use Case Modeling Concepts" section earlier in this chapter, is a relationship between an actor and a use case. The direction of the relationship shows whether the system or the actor initiates the communication. Once communication is established, information can flow in both directions.

To add an association relationship:

1.

145

Chapter 4: Use Cases and Actors

Select the Unidirectional Association toolbar button.

2.

Drag the mouse from the actor to the use case (or from the use case to the actor).

3.

Rose will draw a relationship between the use case and the actor.

To delete an association relationship:

1.

Select the relationship on the Use Case diagram.

2.

Select Edit → Delete from Model, or press Ctrl+D.

Includes Relationship

An includes relationship is used whenever one use case needs to use the functionality provided by another. This relationship implies that one use case always uses the other.

To add an includes relationship:

1.

Select the Dependency toolbar button.

2.

Drag from one use case to the use case being used (from the concrete use case to the abstract use case).

3.

Rose will draw a dependency between the two use cases.

4.

Right−click the relationship's line and select Open Specification.

5.

Rose will open the dependency specification, as shown in Figure 4.21.

146

Chapter 4: Use Cases and Actors

Figure 4.21: Dependency specification

6.

In the Stereotype drop−down list box, select include.

7.

Click OK to close the specification window.

8.

The word <<include>> should appear over the dependency arrow. If it does not, right−click on the relationship's line and be sure there is a check mark next to the Stereotype Label field.

9.

Open the use case specification window of the abstract use case.

10.

Check the Abstract check box.

Note You can also customize the toolbar to provide a button for an includes relationship. Right−click the toolbar and select Customize, then add the Includes Relationship icon.

To delete an includes relationship:

1.

Select the relationship on the Use Case diagram.

2.

Select Edit → Delete from Model, or press Ctrl+D.

147

Chapter 4: Use Cases and Actors

Extends Relationship

In an extends relationship, one use case optionally extends the functionality provided by another. In Rose, extends relationships are modeled much the same as includes relationships.

To add an extends relationship:

1.

Select the Dependency toolbar button.

2.

Drag from the use case providing the extending functionality to the use case being extended (from the abstract use case to the concrete use case).

3.

Rose will draw a dependency between the two use cases.

4.

Right−click on the relationship's line and select Open Specification.

5.

Rose will open the dependency specification.

6.

In the Stereotype drop−down list box, select extend.

7.

Click OK to close the specification window.

8.

The word <<extend>> should appear over the dependency arrow. If it does not, right−click on the relationship's line and be sure there is a check mark next to the Stereotype Label field.

9.

Open the use case specification window of the Abstract use case.

10.

Check the Abstract check box.

To delete an extends relationship:

1.

Select the relationship on the Use Case diagram.

2.

Select Edit → Delete from Model, or press Ctrl+D.

Generalization Relationship

As we discussed above, a generalization relationship is used to show an inheritance among actors or use cases.

148