Breadcrumbs

Use Cases - Lesson 2

development_process_use_cases.png

First, you will update the use case diagrams to consider the new functionality of the Web service.

Linking a Use Case to a Use Case Diagram

You already drew a more detailed use case diagram for the first use case Define Title in lesson 1. Now, you will link the use case Define Title to this use case diagram Define a Title. This facilitates navigating through the model and makes complex models easier to understand.
In the containment tree, navigate to the use case diagram Product Query Overview in the package Data / Overview / Use Cases, and double-click it to open it:

open_productqueryoverview.png

Right-click the tab of Product Query Overview and select Close All Tabs But Current. This will close all open diagrams except the use case diagram Product Query Overview:

close_all_tabs_but_current.png

Select the use case Define Title with the right mouse button and choose Specification from the context menu as shown below:

definetitle_specification.png

The UseCase Specification dialog opens. Select the entry Documentation / Hyperlinks in the left panel:

definetitle_specification_dialog_1.png

Click Add to insert a hyperlink:

definetitle_specification_dialog_2.png

Change to the tab Element/Symbol to select a UML diagram:

definetitle_specification_hyperlink_1.png

To choose a diagram of your UML model, click the button ... :

definetitle_specification_hyperlink_2.png

The containment tree with a collection of UML models is listed:

definetitle_specification_hyperlink_3.png

Select the use case diagram Define a Title. Click OK:

definetitle_specification_hyperlink_4.png

The path of the selected diagram is displayed in the field Select element/symbol or paste element URL. Click OK:

definetitle_specification_hyperlink_5.png

The hyperlink to the use case diagram Define a Title is set. Click Close:

definetitle_specification_hyperlink_6.png

When selecting a UML element, it shows the symbol  icon_hyperlink.png to add a hyperlink. If a hyperlink has been added to a use case symbol, the icon of the target diagram will be embedded in the UML symbol (if the UML element has not the focus). The use case Define Title is linked to use case diagram Define a Title now.  Whenever you double-click a UML element having defined a hyperlink, the linked diagram will open:

definetitle_specification_hyperlink_7.png

After changing any element in MagicDraw, the color of its corresponding entry in the containment tree will change to blue. When you save the model, the color will turn to black again.

Double-click the use case Define Title either on the diagram pane or in the containment tree in the package Data / Overview / Use Cases. The linked use case diagram opens:

open_definetitle.png

Extending Use Case Diagram "Product Query Overview"

You now will extend the use case diagram Product Query Overview considering the additional functionality of the Web service.

In order to draw another use case, you will use a different technique. Select the Use Case symbol from the diagram toolbar, place it on the diagram pane, and start immediately typing the name Insert Product Data into List. Then, press Enter to finish entering the use case name:

toolbar_use_case.png

Rearrange the UML elements on the diagram pane as shown below:

productqueryoverview_new_use_case.png

Draw an association between the actor Consumer and the use case Insert Product Data into List.

productqueryoverview_new_use_case_association.png

Save the UML model.

Creating Use Case Diagram "Insert Product Data into List"

Select the package Data / Overview / Use Cases with the right mouse button and create a new package as shown below:

create_new_package_1.png

Assign the name Insert Product Data Service:

create_new_package_2.png

Select the package Insert Product Data Service with the right mouse button and create a new use case diagram as shown below:

create_use_case_diagram_1.png

Name the use case diagram Insert Product Data into List:

create_use_case_diagram_2.png

You will now add the actor and the use cases to the new use case diagram Insert Product Data into List. Reuse the actor Consumer from package Data / Overview / Use Cases:

create_use_case_diagram_3.png

Drag and drop the actor Consumer onto the use case diagram Insert Product Data into List in the diagram pane:

create_use_case_diagram_4.png

Draw the detailed use case diagram for lesson 2 by choosing the appropriate icons from the diagram toolbar:

toolbar_use_case.png

Draw a use case and name it Insert Product Data into List:

create_use_case_1.png

Add the use cases Enter Product Data and View Product Data:

create_use_case_2.png

Draw an Association between the actor Consumer and the use case Insert Product Data into List:

draw_association.png

Draw Include relations between the use case Insert Product Data into List and the other use cases:

draw_includes.png

Linking UML Elements via Drag & Drop

Linking UML Elements is also possible via drag & drop. You will now link the new use case diagram Insert Product Data into List to the corresponding use case in the overview diagram Product Query Overview.

Switch to the diagram Product Query Overview:

linking_elements_1.png

You will now use a different technique to link diagrams. In the containment tree, navigate to the use case diagram Insert Product Data into List:

linking_elements_2.png

Drag the diagram element from the containment tree to the use case Insert Product Data into List on the diagram pane until the UML element gets surrounded by a blue rectangle. Release the mouse button:

linking_elements_3.png


The use case Insert Product Data into List now is linked to use case diagram Insert Product Data into List and shows the icon icon_activity_diagram_linked.png .

linking_elements_4.png

Save the UML model.