You are here

LockService

A node-level locking service, used by the CheckOutCheckIn service. Does not create a working copy.
Information LockService
Support Status Full Support
Architecture Information Platform Architecture
Description If you need a node-level locking system, then the LockService can provide this. Functionality provided by the service includes:
  • Checking for a lock on a node
  • Obtaining lock information
  • Locking and unlocking a node
  • Suspend and enable locks
Deployment - App Server Deploy as AMP or Simple Module (JAR) package.
Deployment - SDK Project Use SDK archetypes to produce AMP or Simple Module.
Java API Java API Documention
Java example

/** 
 * Return whether a Node is currently locked
 * @param node             The Node wrapper to test against
 * @param lockService      The LockService to use
 * @return whether a Node is currently locked
 */
public static Boolean isNodeLocked(Node node,LockService lockService){
  Boolean locked=Boolean.FALSE;
  if (node.hasAspect(ContentModel.ASPECT_LOCKABLE)) {
    LockStatus lockStatus=lockService.getLockStatus(node.getNodeRef());
    if (lockStatus == LockStatus.LOCKED || lockStatus == LockStatus.LOCK_OWNER) {
      locked=Boolean.TRUE;
    }
  }
  return locked;
}

               
More Information
Tutorials None
SkyVault Developer Blogs None