Book a Demo

Author Topic: API to get username holding lock on element or package  (Read 4952 times)

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
API to get username holding lock on element or package
« 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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: API to get username holding lock on element or package
« Reply #1 on: August 31, 2019, 02:58:18 am »
No. You'll have to get it using Repository.SQLQuery.

I did so many years ago in an add-in.

Geert

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: API to get username holding lock on element or package
« Reply #2 on: September 04, 2019, 06:44:22 pm »
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 & "'")