Book a Demo

Author Topic: DBMS Repository  - Diagram lock problem  (Read 5677 times)

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
DBMS Repository  - Diagram lock problem
« on: March 19, 2013, 02:24:40 am »
Hi

given : EA 9.3 using DBMS repository with required edit lock

when my add-in creates elements, they get automatically locked

except for diagrams ?

When I use diagram.ApplyUserLock() add-in related things (rename diagram for example) work

BUT : user cannot unlock the diagram  ??
So it stays locked indefinitely
(until an administrator steps in I would imagine)

We're all EA newbies here, so my first question is : should this work ?  
have we missed a configuration setting ?

thnx for any insight - help - solution









« Last Edit: March 19, 2013, 02:28:21 am by dannyf »
Reg.

Danny

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DBMS Repository  - Diagram lock problem
« Reply #1 on: March 19, 2013, 07:28:00 am »
If you have Require User Lock to Edit EA holds the lock for the new element. So you should use RelaseUserLock() right after creating the element. Example in Perl:
Code: [Select]
my $pk = $rep->GetTreeSelectedObject();
$pk->ApplyUserLock();
my $e = $pk->Elements->AddNew ("test", "Class");
$e->Update();
$e->ReleaseUserLock();
$pk->ReleaseUserLock();

q.
« Last Edit: March 19, 2013, 07:28:52 am by qwerty »

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: DBMS Repository  - Diagram lock problem
« Reply #2 on: March 19, 2013, 05:10:49 pm »
Thanks Qwerty

I understand (and that's how I implement it now) but there is a bit of a discrepancy.

The Add-in creates packages, elements, connectors and diagrams.
After that everything (except diagrams) is automatically locked for and available to the user (that triggered the add-in action) except again for the diagrams

So his (the user) question is : why do you want me (the user) to lock the diagrams separately ?

And still remains the related question : if the add-in does the applyuserlock() - why can't the user unlock the diagram ?


gr

Reg.

Danny

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13505
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: DBMS Repository  - Diagram lock problem
« Reply #3 on: March 19, 2013, 06:29:10 pm »
Danny,

I'm guessing the locking code in your add-in didn't work.
The fact that you can still rename things in your add-in doesn't mean anything. The API doesn't care for locking.

So I would focus on why the locking didn't work. Did you lock it before Update() -ing it?
Did you check the result of ApplyUserLock?

Geert

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: DBMS Repository  - Diagram lock problem
« Reply #4 on: March 19, 2013, 06:36:00 pm »
Geert, you've got me worried now  :o

for all the things I create via thee Add-in I only 'need' to lock the diagram explicitly. Not the elements, packages - they get locked automatically.
I lock the diagram via applyuserlock, and everything works 100%

However - I also 'need' to release the lock (only on the diagram) because the user can not release it ??

So in fact 2 questions :
- why do I need to lock the diagram and nothing else
- why can't the user unlock the diagram (that has been locked 'in his name' by the add-in)


gr
Reg.

Danny

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13505
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: DBMS Repository  - Diagram lock problem
« Reply #5 on: March 19, 2013, 06:52:54 pm »
Quote
Geert, you've got me worried now  :o

for all the things I create via thee Add-in I only 'need' to lock the diagram explicitly. Not the elements, packages - they get locked automatically.
I lock the diagram via applyuserlock, and everything works 100%

However - I also 'need' to release the lock (only on the diagram) because the user can not release it ??

So in fact 2 questions :
- why do I need to lock the diagram and nothing else
- why can't the user unlock the diagram (that has been locked 'in his name' by the add-in)


gr
We call that EAUI :o
So seriously, I do locking of elements and diagrams all the time in my add-ins and I've never experienced any of that kind of behavior.

But i've also never created new things in my add-ins before either.
Something you might want to try:
- Create diagram
- Save diagram
- Get diagram object again using Repository.GetDiagramBy...
- Lock Diagram

And then see whether or not the user can now unlock the diagram as normal.

Geert

PS. And of course report the strange behavior as bugs to Sparx.

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: DBMS Repository  - Diagram lock problem
« Reply #6 on: March 19, 2013, 08:43:45 pm »
well, good new in a way : EA 10 does not have this problem

Don't have to lock anything explicitly

Reg.

Danny