Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Ian Mitchell on May 05, 2022, 11:42:49 pm
-
Has anyone found where the option "Apply Locks to Connectors" is stored?
It's a really useful feature, and I just need to switch it off for a couple of seconds (from an add-in), then I'll put it right back where I found it - honest...
-
This is what I see in the SQL Server profiler when I check that option:
exec sp_executesql N'INSERT INTO "EA_Training".."t_secpolicies" ("Property","Value") VALUES (@P1,@P2)',N'@P1 nvarchar(14),@P2 nvarchar(1)',N'LockConnectors',N'1'
In other words, in the table t_secpolicies, in the record with the Property 'LockConnectors'.
Now the thing is, that EA will probably load those policies in memory when loading a model. So if you change it in the database behind EA's back, you'll probably need to reload the model before it has any effect.
Geert
-
Thanks Geert - probably not something which I can do quietly.
Plan B.....
If I intercept the 'On Connector Delete' event, I can re-implement a 'you can't do that ' method just fine, but how to stop naughty users - who notice that Connector security is OFF - from accidentally editing 'locked' connectors - that is, connectors between elements which are themselves locked.
Plan C
I'm thinking that maybe I'll fix the problem at source, and instead of using the API to create a connector to a locked element, just use SQL to do it instead.
-
Plan C
I'm thinking that maybe I'll fix the problem at source, and instead of using the API to create a connector to a locked element, just use SQL to do it instead.
That's even naughtier. :o
I try to avoid that as much as possible. Maybe you can fool EA by first making a connector between two other (dummy?) elements, and then changing source and target ID's.
I have a dark brown suspicion that EA will not stop you, even if the source and target ID's belong to locked elements.
But even if they do, it's much easier to use SQL to update an existing connector, than it is to insert a new record into t_connector correctly.
Geert
-
You were, of course, correct.
What made it work was to
(1) Do as you sugested, and create a dummy element, and use that to create a connector (using SQL proved too hard), then
(2) use SQL to update the t_Connector.Start_Object_ID.
Updating that connector through the API also caused a failure due to the element being locked, which I guess is good, as it means the API is accurate in applying the locking rules.
So a SQL UPDATE made it work.
I suppose I should expect this kind of solution when I'm doing such naughty things.
-
As that famous quote from (I think) "Dick Emery" says... "Ooh! You are awful, but I like you". https://www.facebook.com/watch/?v=1673979482717740 (https://www.facebook.com/watch/?v=1673979482717740)
Paolo