/** * 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 unlock the specified node. This request is submitted to the repository immediately. * * @param at the node that is to be unlocked * @return an object that may be used to start another request */ public Conjunction<Graph> unlock( Node at ) { return unlock(at.getLocation()); }
/** * Request to unlock the specified node. This request is submitted to the repository immediately. * * @param at 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( Node at ) { return unlock(at.getLocation()); }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.location.isSame(that.getLocation()); } return false; }
/** * 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()); }
@Override public boolean equals( Object obj ) { if (obj instanceof Node) { Node that = (Node)obj; return this.location.isSame(that.getLocation()); } return false; }
/** * Begin the request to copy the specified node into a parent node at a different location, which is specified via the * <code>into(...)</code> method on the returned {@link Copy} object. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param from the node that is to be copied. * @return the object that can be used to specify addition nodes to be copied or the location of the node where the node * is to be copied */ public Copy<BatchConjunction> copy( Node from ) { return copy(from.getLocation()); }
/** * Request to delete the specified node. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param at the node that is to be deleted * @return an object that may be used to start another request */ public BatchConjunction delete( Node at ) { return delete(at.getLocation()); }
/** * Begin the request to copy the specified node into a parent node at a different location, which is specified via the * <code>into(...)</code> method on the returned {@link Copy} object. * <p> * Like all other methods on the {@link Graph}, the copy request will be performed immediately when the <code>into(...)</code> * method is called. * </p> * * @param from the node that is to be copied. * @return the object that can be used to specify addition nodes to be copied or the location of the node where the node is to * be copied */ public Copy<Graph> copy( Node from ) { return copy(from.getLocation()); }
/** * Begin the request to move the specified node into a parent node at a different location, which is specified via the * <code>into(...)</code> method on the returned {@link Move} object. * <p> * Like all other methods on the {@link Graph}, the move request will be performed immediately when the <code>into(...)</code> * method is called. * </p> * * @param from the node that is to be moved. * @return the object that can be used to specify addition nodes to be moved or the location of the node where the node is to * be moved */ public Move<Conjunction<Graph>> move( Node from ) { return move(from.getLocation()); }
/** * Begin the request to move the specified node into a parent node at a different location, which is specified via the * <code>into(...)</code> method on the returned {@link Move} object. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param from the node that is to be moved. * @return the object that can be used to specify addition nodes to be moved or the location of the node where the node is * to be moved */ public Move<BatchConjunction> move( Node from ) { return move(from.getLocation()); }
/** * Begin the request to clone the specified node into a parent node at a different location, which is specified via the * <code>into(...)</code> method on the returned {@link Clone} object. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param from the node that is to be copied. * @return the object that can be used to specify addition nodes to be copied or the location of the node where the node * is to be copied */ public Clone<BatchConjunction> clone( Node from ) { return clone(from.getLocation()); }
/** * Request to delete the specified node. This request is submitted to the repository immediately. * * @param at the node that is to be deleted * @return an object that may be used to start another request */ public Conjunction<Graph> delete( Node at ) { requests.deleteBranch(at.getLocation(), getCurrentWorkspaceName()); return nextGraph; }
@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 shouldReturnEquivalentLocationForRootUponRepeatedCalls() { Node root = graph.getNodeAt("/"); for (int i = 0; i != 10; ++i) { Node anotherRoot = graph.getNodeAt("/"); assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true)); assertThat(anotherRoot.getLocation().getPath(), is(root.getLocation().getPath())); assertThat(anotherRoot.getLocation().getIdProperties(), is(root.getLocation().getIdProperties())); } }
private String stringValueOf( Node node ) { return node.getLocation().getPath().getLastSegment().getString(context.getNamespaceRegistry()); }
@Test public void shouldFindRootByUUID() { Node root = graph.getNodeAt("/"); Location rootLocation = root.getLocation(); UUID uuid = rootLocation.getUuid(); if (uuid != null) { // Find the root node using the identification properties ... Node anotherRoot = graph.getNodeAt(uuid); assertThat(anotherRoot.getLocation().isSame(root.getLocation()), is(true)); assertThat(anotherRoot.getLocation().getPath(), is(root.getLocation().getPath())); assertThat(anotherRoot.getLocation().getIdProperties(), is(root.getLocation().getIdProperties())); assertThat(anotherRoot.getLocation().getUuid(), is(root.getLocation().getUuid())); } }
@Test public void shouldAlwaysBeAbleToReadRootNode() { Node root = graph.getNodeAt("/"); assertThat("Connector must always have a root node", root, is(notNullValue())); assertThat("Root node must always have a path", root.getLocation().hasPath(), is(true)); assertThat("Root node must never have a null path", root.getLocation().getPath(), is(notNullValue())); assertThat("Root node's path must be the root path", root.getLocation().getPath().isRoot(), is(true)); List<Property> idProperties = root.getLocation().getIdProperties(); if (idProperties == null) { assertThat(root.getLocation().hasIdProperties(), is(false)); } else { assertThat(root.getLocation().hasIdProperties(), is(true)); } }
private UUID uuidFor( Node node ) { UUID uuid = null; if (node.getLocation().getUuid() != null) { uuid = node.getLocation().getUuid(); } if (uuid == null && (node.getProperty(JcrLexicon.UUID) != null)) { uuid = (UUID)node.getProperty(JcrLexicon.UUID).getFirstValue(); } return uuid; }
protected void assertReference( String fromNodePath, String propertyName, String... toNodePath ) { Object[] values = graph.getProperty(propertyName).on(fromNodePath).getValuesAsArray(); assertThat(values.length, is(toNodePath.length)); for (int i = 0; i != values.length; ++i) { Object value = values[i]; assertThat(value, is(instanceOf(Reference.class))); Reference ref = (Reference)value; assertThat(graph.resolve(ref).getLocation().getPath(), is(graph.getNodeAt(toNodePath[i]).getLocation().getPath())); } }