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

Chapter 4: Use Cases and Actors

Right−click the diagram in the browser.

2.

Select Delete from the shortcut menu.

Warning Rose does not allow you to undo a deletion of a diagram or to delete the Main Use Case diagram. Deleting a Use Case diagram will not delete the model elements that were on it. Those will stay in the browser and on any other diagrams.

Adding Use Cases

There are two ways to add a use case to the model. You can add the use case to the active Use Case diagram. Or you can add the new use case directly into the browser, and then add it to a Use Case diagram from the browser.

To add a new use case to a Use Case diagram:

1.

Select the Use Case button from the toolbar.

2.

Click anywhere inside the Use Case diagram. The new use case will be named NewUseCase by default.

3.

With the new use case selected, type in the name of the new use case.

4.

Note that the new use case has been automatically added to the browser, under the Use Case view.

OR

1.

Select Tools → Create → Use Case, as shown in Figure 4.10.

Figure 4.10: Adding a use case to a Use Case diagram

2.

127

Chapter 4: Use Cases and Actors

Click anywhere inside the Use Case diagram to place the new use case. The new use case will be called NewUseCase by default.

3.

With the new use case selected, type in the name of the new use case.

4.

Note that the new use case has been automatically added to the browser, under the Use Case view.

To add an existing use case to a Use Case diagram:

Drag the use case from the browser to the open Use Case diagram.

OR

1.

Select Query → Add Use Cases. A dialog box will display, as in Figure 4.11, that will allow you to select and add existing use cases.

Figure 4.11: Adding existing use cases to a Use Case diagram

2.

In the Package drop−down list box, select the package that contains the use case(s) you want to add.

3.

Move the use case(s) you want to add from the Use Cases list box to the Selected Use Cases list box.

4.

Press OK to add the use cases to the diagram.

To add a use case to the browser:

1.

Right−click the Use Case view package in the browser.

2.

From the shortcut menu, select New → Use Case.

3.

The new use case, called NewUseCase by default, will appear in the browser. To the left of the new

128

Chapter 4: Use Cases and Actors

use case will be the Use Case icon.

4.

With the new use case selected, type in the name of the new use case.

5.

To then add the use case to the diagram, drag the new use case from the browser to the diagram.

Deleting Use Cases

There are two ways to delete a use case. It can be removed from a single diagram or removed from the entire model and all diagrams. As with Use Case diagrams, it's not uncommon to have many extra use cases toward the beginning of a project. They can be very useful for brainstorming the scope of the project. Once the final set of use cases has been agreed upon, however, you will need to go in and delete any extraneous use cases.

To remove a use case from a Use Case diagram:

1.

Select the use case on the diagram.

2.

Press Delete.

3.

Note that the use case has been removed from the Use Case diagram, but still exists in the browser and on other Use Case diagrams.

To remove a use case from the model:

1.

Select the use case on the diagram.

2.

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

3.

Rose will remove the use case from all Use Case diagrams, as well as the browser.

OR

1.

Right−click the use case in the browser.

2.

Select Delete from the shortcut menu.

3.

Rose will remove the use case from all Use Case diagrams, as well as the browser.

129

Chapter 4: Use Cases and Actors

Use Case Specifications

Rose provides detailed specifications for each use case. These specifications can help you document the specific attributes of the use case, such as the use case name, priority, and stereotype. Figure 4.12 shows the use case specification window, which is used to set the use case specifications. In the following sections, we'll take a look at each of the specifications available on the tabs of this window.

Figure 4.12: Use case specification window

To open the use case specifications:

1.

Right−click the use case on a Use Case diagram.

2.

Select Open Specification from the shortcut menu.

OR

1.

Right−click the use case in the browser.

2.

Select Open Specification from the shortcut menu.

OR

1.

Select the use case on a Use Case diagram.

2.

130