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

Chapter 4: Use Cases and Actors

Double−click the relationship in the list.

2.

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

OR

1.

Right−click the relationship in the list.

2.

Select Specification from the shortcut menu.

3.

The relationship specification window will appear. (See the upcoming section titled "Working with Relationships" 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.

Working with Actors

In this section, we'll take a look at how to model actors using Rational Rose. As with use cases, you can keep a lot of details—name, stereotype, relationships, multiplicity, and so on—about an actor in a Rose model. We maintain these details in the actor specification window. Rose uses the same specification window for actors and classes, so we'll see some fields that don't apply to actors.

Adding Actors

As with use cases, there are two ways to add an actor: to an open Use Case diagram or directly into the browser. An actor in the browser can then be added to one or more Use Case diagrams.

To add an actor to a Use Case diagram:

1.

Select the Actor button from the toolbar.

2.

Click anywhere inside the Use Case diagram. The new actor will be named NewClass by default.

3.

137

Chapter 4: Use Cases and Actors

With the new actor selected, type in the name of the new actor. Note that the new actor has been automatically added to the browser, under the Use Case view.

OR

1.

Select Tools → Create → Actor, as shown in Figure 4.17.

Figure 4.17: Adding an actor to a Use Case diagram

2.

Click anywhere inside the Use Case diagram to place the new actor. The new actor will be called NewClass by default.

3.

With the new actor selected, type in the name of the new actor. Note that the new actor has been automatically added to the browser, under the Use Case view.

To add an actor to the browser:

1.

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

2.

Select New → Actor.

3.

The new actor, called NewClass by default, will appear in the browser. To the left of the actor's name will be the Actor icon.

4.

With the new actor selected, type in the name of the new actor.

5.

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

138

Chapter 4: Use Cases and Actors

Deleting Actors

As with use cases, there are two ways to delete an actor: from a single diagram or from the entire model. If you delete an actor from the entire model, it will be removed from the browser as well as all Use Case diagrams. If you delete an actor from a single diagram, it will remain in the browser and on other Use Case diagrams.

To remove an actor from a Use Case diagram:

1.

Select the actor on the diagram.

2.

Press Delete.

To remove an actor from the model:

1.

Select the actor on the diagram.

2.

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

OR

1.

Right−click the actor in the browser.

2.

Select Delete from the shortcut menu.

Rose will remove the actor from all Use Case diagrams as well as the browser. All relationships the deleted actor has with other modeling elements will also be removed.

Actor Specifications

Like a use case, each actor has certain detailed specifications in Rose. In the actor specification window, as shown in Figure 4.18, you can specify the actor's name, stereotype, multiplicity, and other details. In the next several sections, we'll take a look at each of the specifications you can set for an actor.

139

Chapter 4: Use Cases and Actors

Figure 4.18: Actor specification window

As you work with classes later in this book, you may note that the actor specification window and the class specification window are very similar. This is because Rose treats an actor as a specialized form of a class. The actor specification window includes the same fields as the class specification window, but some of these fields are disabled for actors.

To open the actor specifications:

1.

Right−click the actor on the Use Case diagram.

OR

Right−click the actor in the browser.

2.

Select Open Specification from the shortcut menu. The actor specification window will appear.

OR

1.

Select the actor on the Use Case diagram.

2.

Select Browse Specification, or press Ctrl+B. The actor specification window will appear.

140