Class ConcurrencyControlService
java.lang.Object
com.eurodyn.qlack.fuse.cm.service.ConcurrencyControlService
- Author:
- European Dynamics
-
Constructor Summary
ConstructorDescriptionConcurrencyControlService
(NodeMapper nodeMapper, NodeRepository nodeRepository) -
Method Summary
Modifier and TypeMethodDescriptiongetAncestorFolderWithLockConflict
(String nodeID, String lockToken) Checks whether an ancestor folder has lock conflict and returns the first one it will find.getDescendantNodeWithLockConflict
(String nodeID, String lockToken) Checks whether a descendant node has lock conflict and returns the first one it will find.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.void
Locks a node, so that it cannot be modified.void
Unlocks a node.
-
Constructor Details
-
ConcurrencyControlService
-
-
Method Details
-
lock
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 lockeduserID
- 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
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 nodeoverrideLock
- 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
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 checklockToken
- the provided lock token to check for- Returns:
- the NodeDTO with the conflict or null
-
getAncestorFolderWithLockConflict
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 checklockToken
- the provided lock token to check for- Returns:
- Tte FolderDTO of the first locked ancestor folders with which there is a conflict
-
getDescendantNodeWithLockConflict
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 checklockToken
- the provided lock token to check for- Returns:
- the first of the locked descendant NodeDTO with which there is a conflict
-