* is asked if a lock is present.
* @return LockImpl that applies to the given state or <code>null</code>.
* @throws RepositoryException
*/
private LockImpl getLockImpl(NodeState nodeState, boolean lazyLockDiscovery) throws RepositoryException {
NodeState nState = nodeState;
// access first non-NEW state
while (nState.getStatus() == Status.NEW) {
nState = nState.getParent();
}
// shortcut: check if a given state holds a lock, which has been
// store in the lock map. see below (LockImpl) for the conditions that
// must be met in order a lock can be stored.
LockImpl l = getLockFromMap(nState);
if (l != null && l.lockState.appliesToNodeState(nodeState)) {
return l;
}
LockState lState;
if (lazyLockDiscovery) {
// try to retrieve a state (ev. a parent state) that holds a lock.
NodeState lockHoldingState = getLockHoldingState(nState);
if (lockHoldingState == null) {
// assume no lock is present (might not be correct due to incomplete hierarchy)
return null;
} else {
// check lockMap again with the lockholding state