How do you stop Sparx Enterprise Architect adding relationships to all diagrams? - enterprise-architect

When I add a relationship between two elements in a diagram (in this case a communication diagram) in Sparx EA it adds it to every diagram that has those two elements. This means I have to go back and remove it from every other diagram that has those two elements, a task that gets harder the more diagrams you have.
Is there a way to stop this happening?

Not going to discuss the meaning of what you are trying but you can select the connector after creation and from the context menu use Visibility/Hide in other diagrams.
You can also write an add-in that can do that automatically for you. In that case you need to subscribe to EAOnPostNewConnector.

Related

Using EA as a registry

Besides using EA for developing and maintaining various model definitions - is it possible to use it as a repository of instance data?
Let's say that I have defined an class, "Activity". Can I use EA as a repo for the instances of this class?
In my particular use case I'm trying to document various aspects of our helpdesk. In addition to documenting the components pertaining to our support process, I would also like to store the actual implementation information pertaining to these components.
An example:
In a sense, I would like to use EA as a central database of configuration data (the collection of defined activities) and at the same time be able to trace each configuration data item to the formal class definition. Having the possibility to trace these relationships would make it easy for us to know what defined activities nned to be updated if we change the class model, and vice versa.
How can I implement this in EA?
Does this make sense, or am I completely off when it comes to what EA can be used for?
Yes you could do that by creating instances of your classes and setting the run-state.
Create an instance by (Ctrl+) dragging your class onto a class diagram and choosing Instance(Object) for Drop As:
Then use the context menu option Features | Set Run State (Ctrl + Shift + R) to set the run states.
Whether or not this is a good idea I'll leave in the middle.

How to reuse States in Sparx EA

How would I go about re-using states in Sparx EA State Machine Diagrams?
For my application I have a defined list of States (StateA,StateB,StateC, etc) but different objects may transition between them in different manners,
i.e. ObjectA: StateA--(no guard)-->StateB--(input=0)-->StateC
ObjectB: StateA--(input=2)-->StateB--(no guard)-->StateC
If I create these states and put them in their own "package", and then create 2 state machine diagrams and copy these states into the diagrams, whenever I make changes to one diagram the other diagram gets (wrongly) updated.
Or am I thinking about this wrong, and essentially every State Machine Diagram needs to have either its own definition of states/transitions (optionally can reuse existing state machines, but I don't think that solves this problem)?
Looks like I figured it out. If you right click on the state machine diagram, click "Paste as New" and un-click "Include Connectors" it won't copy the connectors into the new diagram, and if you make a transition on these states the other states won't get their transitions modified.

Generate table from diagram in MagicDraw

I see that Magic Draw supports both graphical and tabular notations. However, I would like to know if they can be synchronized to one another or they only function separately. So, if I create a class diagram with the graphical editor, can I generate a table from it in MagicDraw? And whenever I make the changes to one editor, the changes to be reflected in the other editor?
Thank you!
The answer is complex.
First, diagrams are views of the model. Tables, as just another kind of diagrams, are therefore views of the model. In other words, changing an element in a table will change the element in any diagram it is displayed.
Now it gets complex - but how you use the tool can simplify the. You seemed to ask, can a table be synchronized with a table and a table with a diagram? A table can be based on a scope, a query, or by composition (drag an element onto the table or create on the table). Scope or query is is a lot better because they can be used to match the diagram or package where the diagram puts its data (by default, the package where the diagram is stored).
However, diagrams are intended to be expressions of the human for us humans. Thus the diagram does not automatically add elements if they were added in a table.
How do we square the circle? How do we add (or even detect) an element created on a diagram? There is a way to get a list of diagrams (https://community.nomagic.com/usage-in-diagram-displayed-in-generic-table-t5789.html ). Using a similar technique a rule could be created to warn about elements that are not on any diagram. It is still up to you to add the element to the diagram with this information at hand (or write a fancy plugin).

Associating class properties to table columns in Enterprise Architect

In a project I work on there is a C# library containing business objects which are related to the backing database tables/stored procedures.
We imported the code into EA model (where we already have database model) and now I'd like to show dependency between a class and a table (or stored procedure output).
Since these are loosely coupled (i.e. only a portion of properties are shared between them) I'd like to have a relation between a class A and table B and in the properties of this relation to have the mapping (A.a <-> B.a , ...).
Is this possible and how?
You can draw connectors between two elements and then link one or both ends to an element feature (an attribute or an operation). Draw the connector, then right-click near the end and select Link to Element Feature.
You can draw any number of connectors between two elements, and link any number of them to any features at either or both ends.
You should note that this is an EA feature which is not in the UML standard. As such, it is also a little trickier to automate (the feature link is not documented in the API), but I've done it before for a client so it can be done. However, from your question I assume it's the manual case you're interested in.

Enterprise Architect Reverse Engineering - Associations

I have imported Sources in the Enterprise Architect and want to draw both class and sequence diagrams.
Class diagram
The issue here is, if I pull a class from the project browser to the "drawing stage", the members of this class are displayed within the class. How can I get the associations instead of (or in addition to) the members? So if I have a class Builder with a member Room. I want to have both classes and a association between these two. Do I have to pull all the members manually on the "drawing stage" or is there some automatic processing?
Sequence diagram
Can I let the EA draw a sequence diagram for me with just a "starting method" as input?
Thanks
Class diagram
Yes, you can add associated classes. Drop the class onto the diagram, then right-click it and select Add - Related Elements. This causes EA to add to the diagram other elements which have a connector to or from the element you right-clicked.
In the dialog EA opens you can specify a single element type (class, component, etc) to be added and/or a single connector type ("link" in this dialog), eg association, to be followed. Leaving either blank will result in EA adding all element types and/or following all connectors.
You can also specify the connector direction (if for instance you want to add only those directed associations going from the first class, not the ones going to it), as well as the number of links to follow in a chain ("levels").
If you want to hide the members for a specific class, you can right-click the class and select Set Feature Visibility, which brings up a dialog where you can switch the various compartments on or off for that class.
If instead you want to change the presentation of all classes in the diagram you can double-click an empty area of the diagram (or right-click and select Properties), and set presentation of the various compartments in the Elements tab.