Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: OpenIT Solutions on August 31, 2019, 01:01:41 am
-
Hi,
Is there an API to get username or group holding lock on an element or package ?
Regards,
Jon.
-
No. You'll have to get it using Repository.SQLQuery.
I did so many years ago in an add-in.
Geert
-
Hi,
I wanted the username as I wanted to clone an element, this would fail if the package containing the element was locked to someone else. The easier solution I ended up using is below, this changes the elementid of the lock to a random guid, I can then clone and set the lock back. Works for my purpose - might help someone else...
guid = Left(CreateObject("Scriptlet.TypeLib").Guid,38)
Repository.Execute ("UPDATE t_seclocks set EntityID = '" & guid & "' WHERE EntityID = '" & thePackage.PackageGUID & "'")
set newElement = theElement.Clone
Repository.Execute ("UPDATE t_seclocks set EntityID = '" & thePackage.PackageGUID & "' WHERE EntityID = '" & guid & "'")