/** * Request to lock the specified node. This request is submitted to the repository immediately. * * @param at the node that is to be locked * @return an object that allows the scope of the lock to be defined */ public LockScope<LockTimeout<Conjunction<Graph>>> lock( Node at ) { return lock(at.getLocation()); }
/** * Request to lock the node with the given UUID. This request is submitted to the repository immediately. * * @param at the UUID of the node that is to be locked * @return an object that allows the scope of the lock to be defined */ public LockScope<LockTimeout<Conjunction<Graph>>> lock( UUID at ) { return lock(Location.create(at)); }
/** * Request to lock the node with the given identification properties. The identification properties should uniquely identify a * single node. This request is submitted to the repository immediately. * * @param firstIdProperty the first identification property of the node that is to be copied * @param additionalIdProperties the remaining identification properties of the node that is to be copied * @return an object that allows the scope of the lock to be defined */ public LockScope<LockTimeout<Conjunction<Graph>>> lock( Property firstIdProperty, Property... additionalIdProperties ) { return lock(Location.create(firstIdProperty, additionalIdProperties)); }
/** * Request to lock the node at the given path. This request is submitted to the repository immediately. * * @param at the path of the node that is to be locked * @return an object that allows the scope of the lock to be defined */ public LockScope<LockTimeout<Conjunction<Graph>>> lock( Path at ) { return lock(Location.create(at)); }
/** * Request to lock the node with the given unique identification property. This request is submitted to the repository * immediately. * * @param idProperty the unique identifying property of the node that is to be locked * @return an object that allows the scope of the lock to be defined */ public LockScope<LockTimeout<Conjunction<Graph>>> lock( Property idProperty ) { return lock(Location.create(idProperty)); }
/** * Request to lock the node at the given path. This request is submitted to the repository immediately. * * @param atPath the path of the node that is to be locked * @return an object that allows the scope of the lock to be defined */ public LockScope<LockTimeout<Conjunction<Graph>>> lock( String atPath ) { return lock(Location.create(createPath(atPath))); }
@Test public void shouldLockNodeButNotDescendants() { graph.lock(validPath).only().withDefaultTimeout(); assertNextRequestIsLock(Location.create(validPath), LockScope.SELF_ONLY, 0); }
@Test public void shouldLockNodeAndItsDescendants() { graph.lock(validPath).andItsDescendants().withTimeoutOf(12345); assertNextRequestIsLock(Location.create(validPath), LockScope.SELF_AND_DESCENDANTS, 12345); }