labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
53 stars 10 forks source link

Manage concurrent modification in a Team context #76

Open Aurelien-Pin opened 3 years ago

Aurelien-Pin commented 3 years ago

Scripts should be able to perform modification on a Capella model in a Team context. However, in a Team context, an element may already be locked by another user. This case should be considered well managed by the scripts

ylussaud commented 2 years ago

Add APIs for Team for Capella:

stephanelacrampe commented 2 years ago

We should probably be careful with how we name lock/unlock as we don't want the user to think they can unlock objects that may have been modified and not saved whereas what you can unlock is only objects that you took the lock in the first place if I am not wrong. I assume object includes diagrams.

Maybe also add an API to get the info of who has a lock? Maybe also an API to connect/disconnect to the repo and import/export?

SteveMonnier commented 2 years ago

Team for Capella has the API to check if an object is locked, but also check if it is locked by the current user or if it locked by another user. The user can only unlock an element locked by himself.

I am not sure about an API to connect/disconnect or import/export but I may just not see the purpose at the moment

From the TeamForCapella API CDOLockManager, I think the following method should be available for Python4Capella: isExplicitlyLockedByMe(EObject) isLockedByMe(EObject) isLockedByOthers(EObject) isLockedByAny(EObject) isUnlocked(EObject) acquireLock(Collection, boolean, boolean) releaseExplicitLocks(Collection<? extends CDOObject>, boolean) releaseImplicitLocks(Collection<? extends CDOObject>, boolean)

I do not know if there is an equivalent of Javadoc for python, but it may be usefull to remind the user the difference between "Implicit lock" (automatically aquired when modifying an element) and "Explicit lock" (manually aquired by the user through contextual action).

The other methods of this class deal with CDOTransaction or LockStrategy so it does not seem needed for Python scripting.

ylussaud commented 2 years ago

Indeed we should use the same API as Team for Capella. But that make me think this new API can't be open source and should be distributed with Team for Capella. Unless we can do the same API only with CDO.