Author Topic: ReleaseUserLock() Not Working  (Read 7950 times)

Alin Dobre

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
ReleaseUserLock() Not Working
« on: July 07, 2009, 08:59:20 am »
Hello Everyone,

I'm running into the problem of not being able to remove a lock from elements using the automation feature. I have build 7.5.845. Are the following calls: ApplyUserLock(), ApplyGroupLock(), ReleaseUserLock(), and ReleaseGroupLock() still supported in build 845? If not, is there a work around to still allow to apply/remove locks with the automation feature.

Information about oeprations involved:
Im currently applying a lock and make some modificatioins to the element attributes and I call element.Update() and I get the following error. "Element Locked". So i thought well let me release the lock prior to Updating and that didn't work either, I received the same error.

Thanks in Advance.

Regards,

Alin Dobre

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #1 on: July 07, 2009, 12:26:47 pm »
Hello Alin,

I am not sure if it is the same problem, but I think you should read the background information in this thread. It might be worth waiting a (hopefully very short) while for build 846 if the thread is relevant to the methods you are trying to call.

David
No, you can't have it!

Alin Dobre

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #2 on: July 08, 2009, 02:25:35 am »
Is it possible to incountering a race condition, I say this because, all the infomation that Im working on is on a server and needs to be quered. I debugged the code in Visual Studio and while stepping through it, it worked flawlessly. Is it possible that it, being ApplyUserLock() takes a little more time to set and then the Update get called and the lock hasn't been applyed yet and the update says the element is locked...

And David, do you know what the element.Update() actually does, like what steps it takes? More and more I think about it it points to race conditions and if thats the case what everyone else is expereincing is sort of the same problem. And did we get confirmation from Sparx that the Lock commands don't work, or is there any where its states that they have been removed?

Thanks in Advance.

regards,

Alin Dobre

Alin Dobre

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #3 on: July 08, 2009, 06:32:14 am »
Apon further investigation and testing, I can confirm that the Locks methods due in fact work in EA 7.5.845.  And there was a race conditioin happening and in order to get around the whole problem before calling the update element method make sure the lock is on that element/package. Else; it might work, it might not. Due to the fact that the server needs time to set the lock so the time it takes for it to set the lock and the time it takes for the Update to occur can happen before the lock is set and hence the lock up.

Im assuming everyones problem is that they are having race conditions occur, and to confirm again the lock commands do in fact work, regardless of what the API says, im using them. :)

Lock Commands:

ApplyUserLock()
ApplyGroupLock()
ReleaseUSerLock()
ReleaseGroupLock()

Happy Coding :)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: ReleaseUserLock() Not Working
« Reply #4 on: July 08, 2009, 04:12:17 pm »
So how exactly did you solve it?
Have you introduced a sleep() for a few seconds before continuing or...?

ALL_IN_ONE

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #5 on: July 08, 2009, 07:07:24 pm »
Hello folks,

it is good to see that you have the api lock commands in your 7.5 build 845 which is the same one I am using. But I am unable to see those lock API's in my C# project. I have  referenced a Interop.EA.dll to my C# project. But when I see the Object browser of the API functions for the DIagram Class, I dont see the Applyuserlock(), ReleaseUserLock() etc. You can have a look at the snapshot in the below link

http://picasaweb.google.com/dashin.darshan/EnterpriseArchitectPictures?authkey=Gv1sRgCIWdyYjWkPyD3QE&feat=directlink

It would be great to read your expertised comment.  .

Regards,
Coder

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: ReleaseUserLock() Not Working
« Reply #6 on: July 08, 2009, 07:29:01 pm »
I think you should be looking at the IDualDiagram interface.

Geert

ALL_IN_ONE

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #7 on: July 08, 2009, 10:45:36 pm »
hi geert,

nopes its not there in the IDualDiagram either. Actually ApplyUserLock(),RelaseUSerLock() etc are not available in automation neither manual right click options.. i do not know why is this happenning. . .

could this be a license issue?

best regards,
coder

Alin Dobre

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #8 on: July 09, 2009, 01:42:54 am »
Hi Geert,

Well, in our application we are editing the elements in the shared model and require that you apply a userlock on that element or package. Initially we were releasing the lock and allowing the addin to reaply the lock and then update the elements with another program. In that case it required alittle more time to apply the lock then it took to call the Update() and so when Update was called the element wasn't locked yet cause it was "lag" from the server. So the work around for us was to leave the locks in place and just call the addin and then the addin would remove the locks when complete, and it works without a problem, but you could put in a delay, wait, or sleep to slow the addin process before calling the update to make sure that the locks were applied.

If EA supported a method call that would look to see if there is a lock on that particular package/element. The that would make everything much easier for everyone. Hopefully they put those commands like, GetLock(), or GetLockOwner() in the next build, 846.

Regards,

Alin Dobre

Alin Dobre

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #9 on: July 09, 2009, 01:46:36 am »
Hello Coder,

I am 99.9% sure that it is a licensing issue. We have Corporate Keys, and the reason we upgraded from Professional was because of the whole shared model and being able to apply and release locks. So Im betting you have a Professional license key not Corporate.

Hope this helped.

Regards,

Alin Dobre

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: ReleaseUserLock() Not Working
« Reply #10 on: July 09, 2009, 02:57:58 am »
Coder,

I doubt that this is a licencing issue. I think the EA.Interop.dll is going to be the same for all versions.
What I did notice when we did the upgrade to 7.5 here was that some workstations didn't get the new EA.Interop.dll, so it might be an installation issue.
I would check the version of the files responsible for the API.

Regards

Geert

ALL_IN_ONE

  • EA User
  • **
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #11 on: July 10, 2009, 01:05:40 am »
Dear Folks,

nopes I have uninstalled and installed again. also i verified the key is of corporate edition. Secondly when i was using EA 7.1 834 i had the manual as well as API's of ApplyUserLock, ReleaseUserLock(). but the time since I have upgraded to EA 7.5 build 845 I dont see these options. Also what I notice my other collegues use the same EA 7.5 and build 845 but they do have these options.
Can anybody give me idea for the same.

Best Regards,
Coder

Alin Dobre

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: ReleaseUserLock() Not Working
« Reply #12 on: July 10, 2009, 03:32:11 am »
Coder,

Sounds like a back end issue. Have you tried calling sparx customer support? Try doing that if you havn't already.

Best Regards,

Alin Dobre