Package com.orchestranetworks.service.extensions

# Class LockSpec

java.lang.Object
com.orchestranetworks.service.extensions.LockSpec

public class LockSpec extends Object
Handles a lock on a dataspace. When locked, a dataspace can only be modified by the owner of the lock or an administrator.

The methods to call for locking and unlocking a dataspace are `lock(AdaptationHome, Session)` and `unlock(AdaptationHome, Session)`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LockSpec()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `UserMessage`
  `getDescription()`
  `boolean`
  `isChildBranchCreationAllowed()`
  `boolean`
  `isIgnoreLockReason()`
  `boolean`
  `isOwnerPrivileges()`
  `void`
  `lock(AdaptationHome aDataSpace, Session aSession)`
  Locks the specified dataspace.
  `void`
  `setChildBranchCreationAllowed(boolean childBranchCreationAllowed)`
  Declares that it is possible to create a child dataspace when set to `true`.
  `void`
  `setDescription(UserMessage description)`
  Specifies a message describing the the context or reason for the lock.
  `void`
  `setIgnoreLockReason(boolean ignoreLockReason)`
  If `true`, when unlocking, the initial means of the locking is ignored.
  `void`
  `setOwnerPrivileges(boolean allPrivileges)`
  If `true`, assumes the current user is either the owner of the dataspace or the owner of the lock (when unlocking).
  `void`
  `unlock(AdaptationHome aDataSpace, Session aSession)`
  Unlocks the specified dataspace.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LockSpec

    public LockSpec()

- ## Method Details

  - ### lock

    public void lock(AdaptationHome aDataSpace, Session aSession) throws OperationException
    Locks the specified dataspace.

    If the dataspace is already locked, this method throws an exception.

    Note: this method cannot be called inside a procedure execution (because of transaction management restrictions).

    A user can lock a dataspace if:

    - The user is a "super owner" of the dataspace (see Permissions reference page),
    - The user is an administrator,
    - The `LockSpec` instance is in a `setOwnerPrivileges(boolean)` mode.
    Throws:
      `OperationException`
    See Also:
      - `SessionPermissions.getHomeActionPermissionToLockHome(LockSpec, AdaptationHome)`

  - ### unlock

    public void unlock(AdaptationHome aDataSpace, Session aSession) throws OperationException
    Unlocks the specified dataspace.

    If the dataspace is already unlocked, this method throws an exception.

    When dataspace is locked, a user can unlock it if:

    - The user is the owner of the lock,
    - The user is a "super owner" of the dataspace (see permissions),
    - The user is an administrator,
    - The `LockSpec` instance is in a `setOwnerPrivileges(boolean)` mode.

    And if:

    - The means used to unlock the dataspace is the same as that used to lock it That is, if it was locked through the user interface, the user interface must also be used to unlock it, or
    - The `LockSpec` instance is in a `setIgnoreLockReason(boolean)` mode.

    Note:

    - This method cannot be called inside a procedure execution (because of transaction management restrictions).
    - If a parent or child dataspace of the current dataspace has also been locked (for instance, during a merge procedure), only the current dataspace will be unlocked. Another `LockSpec` will have to be created to unlock the other dataspace.
    Throws:
      `OperationException`
    See Also:
      - `SessionPermissions.getHomeActionPermissionToUnlockHome(LockSpec, AdaptationHome)`

  - ### getDescription

    public UserMessage getDescription()
    See Also:
      - `setDescription(UserMessage)`

  - ### setDescription

    public void setDescription(UserMessage description)
    Specifies a message describing the the context or reason for the lock.

    This localized message is displayed in the EBX® user interface when the user accesses a dataspace that is locked.

  - ### setChildBranchCreationAllowed

    public void setChildBranchCreationAllowed(boolean childBranchCreationAllowed)
    Declares that it is possible to create a child dataspace when set to `true`. Default value is `false`.

  - ### isChildBranchCreationAllowed

    public boolean isChildBranchCreationAllowed()

  - ### isOwnerPrivileges

    public boolean isOwnerPrivileges()
    See Also:
      - `setOwnerPrivileges(boolean)`

  - ### setOwnerPrivileges

    public void setOwnerPrivileges(boolean allPrivileges)
    If `true`, assumes the current user is either the owner of the dataspace or the owner of the lock (when unlocking).

  - ### isIgnoreLockReason

    public boolean isIgnoreLockReason()
    See Also:
      - `setIgnoreLockReason(boolean)`

  - ### setIgnoreLockReason

    public void setIgnoreLockReason(boolean ignoreLockReason)
    If `true`, when unlocking, the initial means of the locking is ignored.