Contents


Create editable sequence diagram with Rational Software Architect

Comments

Import the sample application

In working through this example, you will use the Enterprise JavaBeans (EJB) 3.0 Counter sample that is included with IBM® Rational® Software Architect to generate sequence diagrams. First, import this sample application:

  1. Start Rational Software Architect in a new workspace.
  2. Click Help and then Welcome on the menu from the workspace.
  3. Click the Samples icon, as shown in Figure 1, to open a window with options
  4. Select Counter application from the list of sample applications (Figure 2).
  5. Click Import sample from the help window (Figure 3).
  6. It the dialog window that opens, specify the folder where you want to copy the projects in Project location root.

Rational Software Architect then copies all projects of the Counter application to the specified location and imports them into workspace, as shown in Figure 4.

Figure 1. Select samples
Samples icon highlighted in the toolbar
Samples icon highlighted in the toolbar
Figure 2. Select the Counter application
Screen segment shows the Counter application selected
Screen segment shows the Counter application selected
Figure 3. Import the Counter sample
Import sample option selected
Import sample option selected
Figure 4. Counter sample in the workspace
Counter sample projects imported into the workspace

Generate a non-editable sequence diagram

By default, Rational Software Architect generates a non-editable sequence diagram. Follow these steps to create the diagram:

  1. In the Outline tab view shown in Figure 5, select the class and method for which you want to generate sequence diagram.
Figure 5. Select the method from the list in the Outline tab
getRequestParam() selected under PageCodeBase
getRequestParam() selected under PageCodeBase
  1. Right-click on the method, and select Visualize > Add to New Diagram file > Static Method Sequence Diagram, as shown in Figure 6.
Figure 6. Generate a static method sequence diagram
Selections shown in sequence on three drop-down menus
Selections shown in sequence on three drop-down menus
  1. Specify the path to the diagram to be generated in the next window.

Rational Software Architect then generates sequence diagram as shown in Figure 7.

Figure 7. The generated sequence diagram
Sequence diagram for the selected method
Sequence diagram for the selected method

Limitations of a non-editable sequence diagram

Rational Software Architect generates sequence diagrams by literally converting Java code, line by line. In most of the cases, especially for complex code, the generated diagrams become too complex, so they are very difficult to understand. Therefore, we need editable sequence diagrams so that we can add abstraction, delete unnecessary elements, add comments, and so forth.

Generate an editable sequence diagram

The extension of the static diagram is .tpx, which cannot be modified. To make the diagram editable, right-click on the diagram, and select File > Save as Diagram File, as shown in Figure 8.

Figure 8. Save as Diagram File selected on the context menu
File > Save as Diagram File selected on two drop-down menus
File > Save as Diagram File selected on two drop-down menus

The extension of the new diagram is .dnx. Diagram files can use various extensions, but .dnx is the most common one, and the .dnx extension can be modified. As Figure 9 shows, the Palette window also appears so that you can edit the diagram.

Figure 9. Editable Sequence diagram
.dnx diagram on left, Palette pane on right
.dnx diagram on left, Palette pane on right

Acknowledgement

The author thanks Saldy Mathew from IBM India for encouraging him to transform his findings into article.


Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=821113
ArticleTitle=Create editable sequence diagram with Rational Software Architect
publish-date=06192012