Class ConcurrencyControlService

java.lang.Object
com.eurodyn.qlack.fuse.cm.service.ConcurrencyControlService

@Service public class ConcurrencyControlService extends Object
Author:
European Dynamics
  • Constructor Details

    • ConcurrencyControlService

      @Autowired public ConcurrencyControlService(NodeMapper nodeMapper, NodeRepository nodeRepository)
  • Method Details

    • lock

      public void lock(String nodeID, String lockToken, boolean lockChildren, String userID)
      Locks a node, so that it cannot be modified. If the node is already locked then an exception is thrown.
      Parameters:
      nodeID - The id of the node to be locked.
      lockToken - A token used to lock the node. All future operations altering this node will be blocked while the node is locked unless the token used to lock the node is passed to the operation.
      lockChildren - Whether child nodes of this node should also be locked
      userID - The ID of the user who locked this node. This will be used simply as metadata for the lock and will not be taken into account when checking if a locked node can be edited.
      Throws:
      QNodeLockException - If the specified node is already locked
    • unlock

      public void unlock(String nodeID, String lockToken, boolean overrideLock, String userID)
      Unlocks a node. Before this method attempts to unlock a node it checks to see whether it has been previously locked or not therefore you can safely use it even if you do not know the current lock state of a node.
      Parameters:
      nodeID - The id of the node to be unlocked.
      lockToken - The token with which the node was locked which will be used to unlock the node
      overrideLock - If false then this method will not attempt to use the passed lock token but will just unlock the node by setting null as the current token.
      userID - The ID of the user who locked this node. This will be used simply as metadata for the lock and will not be taken into account when checking if a locked node can be edited.
      Throws:
      QNodeLockException - If the node cannot be unlocked with the passed token
    • getSelectedNodeWithLockConflict

      public NodeDTO getSelectedNodeWithLockConflict(String nodeID, String lockToken)
      Checks whether a specific node has lock conflict, by examining if the provided lock token, is different from the lockTocken of the node.
      Parameters:
      nodeID - the UUID of the node to check
      lockToken - the provided lock token to check for
      Returns:
      the NodeDTO with the conflict or null
    • getAncestorFolderWithLockConflict

      public FolderDTO getAncestorFolderWithLockConflict(String nodeID, String lockToken)
      Checks whether an ancestor folder has lock conflict and returns the first one it will find. A lock conflict in this case happens when the provided lock token, is different from the lockTocken of a specific ascendant folder.
      Parameters:
      nodeID - the UUID of the node to check
      lockToken - the provided lock token to check for
      Returns:
      Tte FolderDTO of the first locked ancestor folders with which there is a conflict
    • getDescendantNodeWithLockConflict

      public NodeDTO getDescendantNodeWithLockConflict(String nodeID, String lockToken)
      Checks whether a descendant node has lock conflict and returns the first one it will find. A lock conflict in this case happens when the provided lock token, is different from the lockTocken of a descendant node.
      Parameters:
      nodeID - the UUID of the node to check
      lockToken - the provided lock token to check for
      Returns:
      the first of the locked descendant NodeDTO with which there is a conflict