Decision Center API

ilog.rules.teamserver.model
Interface IlrLockingFacility

All Known Subinterfaces:
IlrSession

public interface IlrLockingFacility

Locking services provided by a Decision Center session.

The objects of type project element IlrProjectElement can be locked by users. When an object is locked by a user A, user B cannot edit nor delete nor lock this object. When the locked object is a rule package, all its contained project elements (rules, decision table, ruleflows, and so on) are also locked. On user request, all the subpackages of a package can also be locked. This package is then called the root lock, and all the content and subpackages are locked until this root lock is unlocked. You cannot unlock an element that is not a root lock.

See Also:
IlrSession

Method Summary
 void checkIsElementBusy(IlrElementHandle element)
          Throws an exception if the given element is locked by another user.
 void clearAllLocks()
          Clears all persistent and non-persistent locks of the table.
 void clearNonPersistentLocks()
          Clears all non-persistent locks.
 String getLockOwner(IlrElementHandle element)
          Returns the name of the user who owns the lock.
 IlrElementHandle getRootLockedElementForElement(IlrElementHandle element)
          Returns the root lock for the given element.
 boolean isElementBusy(IlrElementHandle element)
          Returns true if this element is locked by a user different from the current one.
 boolean isPersistentLock(IlrElementHandle element)
          Indicates whether the lock on the given element is persistent or not.
 void lockBranches(IlrBaseline branch)
          Locks the whole branch given as a parameter, and the working branch.
 void lockElement(IlrElementHandle element)
          Locks the given element.
 void lockElement(IlrElementHandle element, boolean persistent, boolean recursive)
          Locks the given element.
 void lockElements(List<? extends IlrElementHandle> elements, boolean persistent, boolean recursive)
          Locks the list of elements.
 boolean ownsLock(IlrElementHandle element)
          Returns true if this element is locked by the current user.
 void releaseElementLock(IlrElementHandle element)
          Forces the unlocking of the given element.
 void releaseElementLocks(List<? extends IlrElementHandle> elements)
          Forces the unlocking of the given elements.
 void releaseNonPersistentLocks()
          Releases all non-persistent locks that were created by the current user.
 void unlockBranches(IlrBaseline branch)
          Releases the branch locks that were created with the lockBranches(IlrBaseline) function.
 void unlockElement(IlrElementHandle element)
          Unlocks the given element.
 void unlockElements(List<? extends IlrElementHandle> elements)
          Unlocks the given list of elements.
 

Method Detail

lockElement

void lockElement(IlrElementHandle element)
                 throws IlrObjectNotFoundException,
                        IlrObjectLockedException,
                        IlrObjectNotRootLockException,
                        IlrPermissionException,
                        IlrFrozenBaselineException
Locks the given element.

If the element is a rule package, all project elements contained in this package will be locked (rules, decision tables, ruleflows, and so on). However the subpackages will not be locked.

This method is equivalent to lockElement(elt, false, false).

Throws:
IlrObjectNotFoundException - If the element to lock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrObjectNotRootLockException - If the element to lock is locked by the user and is not the root lock.
IlrFrozenBaselineException - TODO
IlrPermissionException
Parameters:
element - Handle on the element to lock.

lockElement

void lockElement(IlrElementHandle element,
                 boolean persistent,
                 boolean recursive)
                 throws IlrObjectNotFoundException,
                        IlrObjectLockedException,
                        IlrObjectNotRootLockException,
                        IlrPermissionException,
                        IlrFrozenBaselineException
Locks the given element.

If the element is a rule package, all project elements contained in this package will be locked (rules, decision tables, ruleflows, and so on). However the subpackages will not be locked unless the recursive flag is true.

Throws:
IlrObjectNotFoundException - If the element to lock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrObjectNotRootLockException - If the element to lock is locked by the user and is not the root lock.
IlrFrozenBaselineException - TODO
IlrPermissionException
Parameters:
element - Handle on the element to lock.
persistent - If true, the lock is not released when the session expires.
recursive - If true and if the element is a rule package, then all its subpackages will be locked.

unlockElement

void unlockElement(IlrElementHandle element)
                   throws IlrObjectNotFoundException,
                          IlrObjectLockedException,
                          IlrObjectNotLockedException,
                          IlrObjectNotRootLockException,
                          IlrPermissionException,
                          IlrFrozenBaselineException
Unlocks the given element.

Throws:
IlrObjectNotFoundException - If the element to unlock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrObjectNotLockedException - If the object to unlock is not locked.
IlrObjectNotRootLockException - If the element to lock is locked by the user and is not the root lock.
IlrFrozenBaselineException - TODO
IlrPermissionException
Parameters:
element - Handle on the element to unlock.

lockBranches

void lockBranches(IlrBaseline branch)
                  throws IlrObjectLockedException,
                         IlrInvalidElementException,
                         IlrFrozenBaselineException,
                         ilog.rules.teamserver.model.IlrAPIException,
                         IlrApplicationException
Locks the whole branch given as a parameter, and the working branch. The lock prevents other users to update any element within those two branches. The operation succeeds only if nobody else owns a lock for an element within those two branches.

Throws:
IlrObjectLockedException - if any element of the project is already locked by someone else.
IlrInvalidElementException - if the argument or the working branch is null.
IlrFrozenBaselineException - if the argument or the working branch is not a branch.
IlrApplicationException
ilog.rules.teamserver.model.IlrAPIException
Parameters:
branch - the second branch to lock.

unlockBranches

void unlockBranches(IlrBaseline branch)
                    throws IlrFrozenBaselineException,
                           IlrInvalidElementException,
                           IlrObjectNotFoundException,
                           IlrObjectLockedException,
                           IlrObjectNotLockedException,
                           IlrObjectNotRootLockException,
                           IlrPermissionException
Releases the branch locks that were created with the lockBranches(IlrBaseline) function.

Throws:
IlrInvalidElementException - if the argument or the working branch is null.
IlrPermissionException
IlrObjectNotRootLockException
IlrObjectNotLockedException
IlrObjectLockedException
IlrObjectNotFoundException
IlrFrozenBaselineException

releaseNonPersistentLocks

void releaseNonPersistentLocks()
Releases all non-persistent locks that were created by the current user.

Non-persistent locks should be released automatically when the session is closed. However, in case of a system failure, this automatic cleaning may not be executed. In those cases, the locks will remain active, and cannot be cleared by the user through a new session. This function should be used in such circumstances.


ownsLock

boolean ownsLock(IlrElementHandle element)
                 throws IlrObjectNotFoundException,
                        IlrApplicationException
Returns true if this element is locked by the current user.

Throws:
IlrObjectNotFoundException - If the given element cannot be found.
IlrApplicationException
Parameters:
element - Handle on the element to test.

isElementBusy

boolean isElementBusy(IlrElementHandle element)
                      throws IlrObjectNotFoundException,
                             IlrApplicationException
Returns true if this element is locked by a user different from the current one.

Throws:
IlrObjectNotFoundException - If the given element cannot be found.
IlrApplicationException
Parameters:
element - Handle on the element to test.

getLockOwner

String getLockOwner(IlrElementHandle element)
                    throws IlrObjectNotFoundException,
                           IlrApplicationException
Returns the name of the user who owns the lock.

Throws:
IlrObjectNotFoundException - If the given element cannot be found.
IlrApplicationException
Parameters:
element - Handle on a locked element.

getRootLockedElementForElement

IlrElementHandle getRootLockedElementForElement(IlrElementHandle element)
                                                throws IlrObjectNotFoundException
Returns the root lock for the given element.

Throws:
IlrObjectNotFoundException - If the given element cannot be found.
Parameters:
element - Handle on a package element or a rule package.
Returns:
A handle on the root lock. Returns null if the element is not locked.

clearAllLocks

void clearAllLocks()
Clears all persistent and non-persistent locks of the table.

This method can be called by the administrator only.


clearNonPersistentLocks

void clearNonPersistentLocks()
Clears all non-persistent locks.

Typically, this method can be called after a server crash that would prevent the session end to automatically release the non-persistent locks.

This method can be called by the administrator only.


isPersistentLock

boolean isPersistentLock(IlrElementHandle element)
                         throws IlrApplicationException
Indicates whether the lock on the given element is persistent or not.

Throws:
IlrApplicationException
Parameters:
element - Handle on a package element or a rule package.

checkIsElementBusy

void checkIsElementBusy(IlrElementHandle element)
                        throws IlrObjectLockedException,
                               IlrObjectNotFoundException,
                               IlrApplicationException
Throws an exception if the given element is locked by another user.

Throws:
IlrObjectLockedException - If the element is locked by someone else.
IlrObjectNotFoundException - If the given element cannot be found in the database.
IlrApplicationException
Parameters:
element - Handle on the element to test.

lockElements

void lockElements(List<? extends IlrElementHandle> elements,
                  boolean persistent,
                  boolean recursive)
                  throws IlrObjectNotFoundException,
                         IlrObjectLockedException,
                         IlrFrozenBaselineException,
                         IlrObjectNotRootLockException,
                         IlrPermissionException
Locks the list of elements.

Throws:
IlrObjectNotFoundException - If the element to lock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrFrozenBaselineException - If the working baseline is not frozen.
IlrObjectNotRootLockException - If the element to lock is locked by the user and is not the root lock.
IlrPermissionException
Parameters:
elements - A list of element handles (IlrElementHandle).
persistent - If true, the lock is not released when the session expires.
recursive - If true and if the element is a rule package, then all its subpackages will be locked.

unlockElements

void unlockElements(List<? extends IlrElementHandle> elements)
                    throws IlrObjectNotFoundException,
                           IlrObjectLockedException,
                           IlrObjectNotLockedException,
                           IlrObjectNotRootLockException,
                           IlrPermissionException,
                           IlrFrozenBaselineException
Unlocks the given list of elements.

Throws:
IlrObjectNotFoundException - If the element to unlock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrObjectNotLockedException - If the object to unlock is not locked.
IlrObjectNotRootLockException - If the element to unlock is locked by the user and is not the root lock.
IlrFrozenBaselineException - TODO
IlrPermissionException
Parameters:
elements - A list of element handles (IlrElementHandle).

releaseElementLock

void releaseElementLock(IlrElementHandle element)
                        throws IlrApplicationException
Forces the unlocking of the given element.

Throws:
IlrPermissionException - If the current user is not an administrator.
IlrObjectNotFoundException - If the element to unlock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrFrozenBaselineException - If the working baseline is not frozen.
IlrObjectNotRootLockException - If the element to unlock is locked by the user and is not the root lock.
IlrObjectNotLockedException - If the object to unlock is not locked.
IlrApplicationException
Parameters:
element - Handle on an element to unlock.

releaseElementLocks

void releaseElementLocks(List<? extends IlrElementHandle> elements)
                         throws IlrApplicationException
Forces the unlocking of the given elements.

Throws:
IlrPermissionException - If the current user is not an administrator.
IlrObjectNotFoundException - If the element to unlock cannot be found in the database.
IlrObjectLockedException - If the element is already locked by someone else.
IlrFrozenBaselineException - If the working baseline is not frozen.
IlrObjectNotRootLockException - If the element to unlock is locked by the user and is not the root lock.
IlrObjectNotLockedException - If the object to unlock is not locked.
IlrApplicationException
Parameters:
elements - List of element handles (IlrElementHandle).

Decision Center API

© Copyright IBM Corp. 1987, 2013