/** * {@inheritDoc} * * @see org.modeshape.graph.Graph.To#to(java.lang.String) */ public java.util.Map<String, Serializable> to( String desiredPath ) { return to(Location.create(createPath(desiredPath))); } };
/** * 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<BatchConjunction>> lock( String atPath ) { return lock(Location.create(createPath(atPath))); }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.getLocation().isSame(that.getLocation()); } return false; }
@Test public void shouldCreateNodesWithBatch() { graph.batch().create(validPath, validIdProperty1).and().remove("prop").on(validPathString).execute(); graph.batch().move(validPath).and(validPath).into(validPathString).and().create(validPath).and().execute(); graph.batch().createUnder(validLocation).nodeNamed("someName").and().delete(validLocation).execute(); }
@Test public void shouldSetPropertyWithEitherOnOrToMethodsCalledFirst() { graph.set("propName").on(validPath).to(3.0f); assertNextRequestSetProperty(Location.create(validPath), createProperty("propName", 3.0f)); graph.set("propName").to(3.0f).on(validPath); assertNextRequestSetProperty(Location.create(validPath), createProperty("propName", 3.0f)); }
/** * Request to delete 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 deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( String atPath ) { return delete(Location.create(createPath(atPath))); }
@Test public void shouldLockNodeAndItsDescendants() { graph.lock(validPath).andItsDescendants().withTimeoutOf(12345); assertNextRequestIsLock(Location.create(validPath), LockScope.SELF_AND_DESCENDANTS, 12345); }
@Test public void shouldLockNodeButNotDescendants() { graph.lock(validPath).only().withDefaultTimeout(); assertNextRequestIsLock(Location.create(validPath), LockScope.SELF_ONLY, 0); }
/** * Request to delete 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 deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( Path at ) { return delete(Location.create(at)); }
/** * 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))); }
/** * 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 unlock 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 unlocked * @return an object that may be used to start another request */ public Conjunction<Graph> unlock( Path at ) { return unlock(Location.create(at)); }
/** * Request to unlock 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 unlocked * @return the interface that can either execute the batched requests or continue to add additional requests to the batch */ public BatchConjunction unlock( Property idProperty ) { return unlock(Location.create(idProperty)); }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.location.isSame(that.getLocation()); } return false; }
/** * Get the name of the current workspace being used by this graph. If the graph has not yet been instructed to * {@link #useWorkspace(String) use} or {@link #createWorkspace() create} a workspace, this method will assume that the * source's default workspace is to be used and will obtain from the source the name of that default workspace. * * @return the name of the current workspace; never null * @see #getCurrentWorkspace() */ public String getCurrentWorkspaceName() { return getCurrentWorkspace().getName(); }
/** * 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<BatchConjunction>> lock( Node at ) { return lock(at.getLocation()); }
/*package*/CopyAction( T afterConjunction, Location from ) { super(afterConjunction); this.from = new Locations(from); this.fromWorkspaceName = Graph.this.getCurrentWorkspaceName(); }
/** * Request to delete 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 may be used to start another request */ public Conjunction<Graph> delete( Property firstIdProperty, Property... additionalIdProperties ) { return delete(Location.create(firstIdProperty, additionalIdProperties)); }
/** * 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)); }