Sequence Diagrams and Version Control
You might create Sequence diagrams that use elements from other packages as the Lifelines within the diagram. In such cases, the diagrams could be corrupted when the element packages are checked in and out under version control. This is because during checkout the elements are first deleted from the model and then re-imported, and although they are reinstated in the diagrams, any Messages connecting them are not.
So, if the diagram and its elements reside in different packages, a round-trip of the element package through version control might damage the Sequence diagram.
The solution is to drag-and-drop each Class onto the Sequence diagram as an object - when you drop the Class onto the Sequence diagram, in the Paste Element dialog select the as Instance of Element (Object) option. This creates a new object in the diagram's parent package, based on the selected Class element. You then create the Messages between the objects.
Therefore, to ensure that a Sequence diagram is not damaged by round-trips of other packages through version control, remember that:
- The Lifelines must be objects (even though Enterprise Architect allows you to drop elements as Lifelines onto a Sequence diagram, it is not a strictly UML compliant construct)
- The Lifelines must be in the same package as the diagram.
The following illustration shows the Project Browser with two packages: P1, containing the elements, and P2, containing a Sequence diagram that uses those elements. The diagram itself is also shown.
This diagram is not damaged, because all the Lifelines are objects and these objects reside in the same package as the Sequence diagram.