Book a Demo

Author Topic: Protecting diagrams from "NEW" connectors  (Read 8201 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Protecting diagrams from "NEW" connectors
« on: June 24, 2016, 05:29:29 pm »
When you have a diagram, even if completely locked so no-one can edit it, if you create a new connector in another diagram, EA will add the connector to all the diagrams on which the two end elements are to be found.  Now this is part of the notion of a "model" - you change something somewhere, it changes everywhere.

This is theoretically fine, but in practice - at enterprise scale - it can create havoc!

The purpose of the locking function is to stop users  (or even maliciously) altering diagrams.  In fact, the options are disabled.  However, it doesn't (not, I would argue, necessarily) should it stop EA from making changes based on the underlying model changes.

Now as I indicated above, in many enterprise scale circumstances (and, indeed, many others) it may be the case that there are diagrams which need to be "frozen" in a certain state.  For example, they may have been used to snapshot into a document.

See how I used the term frozen rather than locked?  Freezing could be used to control EA's changes tot he diagram.

Now, whether a connector is to be visible on a diagram is a property of the diagram (so to speak) not the connector (as we know, it's actually a property of the diagram link row).  So it seems to me that for a given diagram, once the user has decided which connectors will be visible,  Freezing the diagram should tell EA NOT to make any new connectors (that could theoretically be) visible on the diagram.

Ok, this is simple to say, but how to achieve?  Well, it's actually quite easy.  Since the surrogate key (SK) of the connector (Connector_ID) is a monotonically increasing value, if the frozen property holds the highest SK of the connectors on the diagram, any connectors with SKs higher than that MUST be new and therefore should be placed on the diagram and HIDDEN!

Should the user want to unfreeze the diagram, they can do so and make any changes to the visible/invisible connectors currently defined (using the Set Visible Relations [Alt+I]). Unfreezing discards the recorded SK value and allows future new connectors to be added to the diagram.  Re-freezing at a later time will go round the loop again.

We have users complaining frequently about the current (less than helpful behaviour, for our purposes) and will be implementing this functionality (awaiting, hopefully, Sparx's implementation).

Before we implement, though, I'd like thoughts and comments to make sure I've thought it through and, if there's support, putting the proposal to Sparx.

Thoughts?
Paolo
« Last Edit: June 24, 2016, 07:30:45 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Protecting diagrams from "NEW" connectors
« Reply #1 on: June 24, 2016, 05:41:18 pm »
Seems like a sensible request.

But I would try to find a solution that doesn't rely on the connectorIDs.

Your add-in (or EA-Matic script) could intervene at the creation of the connector and hide it on all frozen diagrams.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Protecting diagrams from "NEW" connectors
« Reply #2 on: June 24, 2016, 07:31:55 pm »
Seems like a sensible request.

But I would try to find a solution that doesn't rely on the connectorIDs.

Your add-in (or EA-Matic script) could intervene at the creation of the connector and hide it on all frozen diagrams.

Geert
I'm open to suggestions.  I couldn't think of an alternative since connectors don't have any auditing timestamps.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Protecting diagrams from "NEW" connectors
« Reply #3 on: June 24, 2016, 07:38:47 pm »
Seems my suggestion was not clear enough :-[

In your case I think I would implement EA_OnPostNewConnector and in that function get all the diagrams this new connector will show up in.
Then for each diagram check if it is a "frozen" diagram, and in that case hide the connector from that diagram.

This avoid having to use the  connectorIDs, but it requires your add-in to be installed and active on all  users of the model.

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Protecting diagrams from "NEW" connectors
« Reply #4 on: June 27, 2016, 08:57:39 am »
Ok, this is simple to say, but how to achieve?  Well, it's actually quite easy.  Since the surrogate key (SK) of the connector (Connector_ID) is a monotonically increasing value, if the frozen property holds the highest SK of the connectors on the diagram, any connectors with SKs higher than that MUST be new and therefore should be placed on the diagram and HIDDEN!
Nice thought, but completely broken when replication is enabled.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Protecting diagrams from "NEW" connectors
« Reply #5 on: June 27, 2016, 09:39:10 am »
Ok, this is simple to say, but how to achieve?  Well, it's actually quite easy.  Since the surrogate key (SK) of the connector (Connector_ID) is a monotonically increasing value, if the frozen property holds the highest SK of the connectors on the diagram, any connectors with SKs higher than that MUST be new and therefore should be placed on the diagram and HIDDEN!
Nice thought, but completely broken when replication is enabled.
Replication?  What is this replication of which you speak?

Seriously though, thanks for the "heads up".   Fortunately for us, it's not an issue.

Also, seriously, is there support for putting it to Sparx to implement something to obviate this (fairly serious) problem?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Protecting diagrams from "NEW" connectors
« Reply #6 on: June 27, 2016, 10:58:18 am »
SQL Server Replication - msdn.microsoft.com
or
Access replication

Other database types may or may not have similar features.

When these are enabled, all auto-increment ids are replaced by random numbers across the entire number space. (Which is why I have previously said use <> 0 instead of >0)