Results results = store.batch().move(nodeToMove).as(newName).into(newParentPath).execute(); MoveBranchRequest moveRequest = (MoveBranchRequest)results.getRequests().get(0); Location locationAfter = moveRequest.getActualLocationAfter();
@Test public void shouldMoveNodeInBatches() { graph.batch().move(validPath).into(validIdProperty1, validIdProperty2).execute(); assertThat(numberOfExecutions, is(1)); assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2)); assertNoMoreRequests(); graph.batch().move(validPathString).into(validIdProperty1, validIdProperty2).execute(); assertThat(numberOfExecutions, is(1)); assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2)); assertNoMoreRequests(); graph.batch().move(validUuid).into(validPath).execute(); assertThat(numberOfExecutions, is(1)); assertNextRequestIsMove(Location.create(validUuid), Location.create(validPath)); .move(validPath) .into(validIdProperty1, validIdProperty2) .and() .move(validPathString) .into(validIdProperty1, validIdProperty2) .and() .move(validUuid) .into(validPath) .execute();
/** * Begin the request to move a node with the specified identification properties into a parent node at a different * location, which is specified via the <code>into(...)</code> method on the returned {@link Move} object. The * identification properties should uniquely identify a single node. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param firstIdProperty the first identification property of the node that is to be moved * @param additionalIdProperties the remaining identification properties of 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( Property firstIdProperty, Property... additionalIdProperties ) { return move(Location.create(firstIdProperty, additionalIdProperties)); }
/** * Begin the request to move a node with the specified unique identification property into a parent node at a different * location, which is specified via the <code>into(...)</code> method on the returned {@link Move} object. The * identification property should uniquely identify a single node. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param idProperty the unique identification property of 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( Property idProperty ) { return move(Location.create(idProperty)); }
/** * Begin the request to move a node with the specified unique identifier 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 UUID of 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( UUID from ) { return move(Location.create(from)); }
/** * Begin the request to move a node located at the supplied path 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 fromPath the path to 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( String fromPath ) { return move(Location.create(createPath(fromPath))); }
/** * Begin the request to move a node with the specified identification properties into a parent node at a different * location, which is specified via the <code>into(...)</code> method on the returned {@link Move} object. The * identification properties should uniquely identify a single node. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param idProperties the identification properties of 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( Iterable<Property> idProperties ) { return move(Location.create(idProperties)); }
/** * 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 move a node located at the supplied path 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 path to 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( Path from ) { return move(Location.create(from)); }
@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(); }