3
« on: June 27, 2023, 07:25:20 pm »
Our community has a set of models that use a common UML profile that was created 20 years ago and is currently being updated. We use our own stereotyped composition association, and for reasons now forgotten it has the part as source end and the composite at the target end – so it must be drawn from part to composite. That way round is unexpected to the majority of today’s modellers, so we are updating our profile to use a more conventional kind of association instead. For consistency of the model – at least how the modellers see “Source” and “Target” when they inspect association properties – we would also like to update the existing associations. There are thousands, so we would automate this. I have been exploring EA scripting for this.
A script successfully navigates to all Connector objects, identifies the right ones, and manipulates their properties. Properties that are objects are read-only, but the leaf-level attributes can be changed, and I seem to have successfully swapped ClientID and SupplierID, and ClientEnd and SupplierEnd internal properties like Aggregation, Role, Cardinality and Navigable – so the diagrams basically look the same as before.
For a minority of associations this breaks the geometry of the link on the diagram. I found DiagramLink.Geometry, but I couldn’t find any documentation of the Geometry format, or a way to know which links will break, and how to correct them. As a compromise it may be feasible to manually look through a hundred diagrams and force link redrawing by a minute adjustment of the positions of affected classes.
A more severe problem is that some multiplicities disappear from diagrams. All our compositions have multiplicity stated at the part end (which was the source but will now be the target) and not at the composite end (which is implicitly always 1). The UI has Visibility | Set Label Visibility which brings up a dialog of selection boxes with various labels, and in that the multiplicity of the composite end is unchecked (hidden) – or after supplier-client swapping it’s the part end multiplicity that is hidden (but we need to see it). I can change this in the UI, but I want to avoid doing that for one thousand associations.
I have read that HDN=0 / HDN = 1 within geometry determines visibility, but that doesn’t agree with what I am seeing - where the Geometry strings for links with missing visibility don’t have any HDN=1, and where if I manually change the label visibility in the UI, to force the multiplicity of the part end to appear, the only change in the Geometry strings is to nudge what looks like coordinates by 1 – no more or fewer fields and no change to HDNs.
Any ideas of a better approach to swapping the roles of source and target with respect to the composition?
If not, any information on how the visibility of multiplicities could be scripted, given the apparent non-use of HDN for this?
And is there any idea how to avoid needing to manually force a redraw of diagram links with broken geometry?