@Override public ReturnType remove() { batch.delete(path); properties.clear(); return and(); } }
batch.delete(pathToOldNamespaceNode).and();
/** * Record the fact that the supplied node is in the process of being deleted, so any cached information (outside of the node * object itself) should be cleaned up. * * @param node the node being deleted; never null */ protected void recordDelete( Node<Payload, PropertyPayload> node ) { // Record the operation ... Location location = node.getLocation(); operations.delete(location); UUID nodeUuid = uuidFor(location); if (nodeUuid != null) { deletedNodes.add(nodeUuid); } // Fix the cache's state ... removeNode(node.getNodeId()); recordUnloaded(node); }
deleteExistingBatch.delete(childLocation).and(); break; // nothing more to do for this child
protected boolean doUnregister( String uri ) { // Read the store ... ValueFactory<String> stringFactory = store.getContext().getValueFactories().getStringFactory(); boolean result = false; try { Subgraph nsGraph = store.getSubgraphOfDepth(2).at(parentOfNamespaceNodes); // Iterate over the existing mappings, looking for one that uses the prefix and uri ... Set<Location> locationsToRemove = new HashSet<Location>(); for (Location nsLocation : nsGraph.getRoot().getChildren()) { Node ns = nsGraph.getNode(nsLocation); String actualUri = stringFactory.create(ns.getProperty(uriPropertyName).getFirstValue()); if (actualUri.equals(uri)) { locationsToRemove.add(ns.getLocation()); result = true; } } // Remove any other nodes that have the same URI ... Graph.Batch batch = store.batch(); for (Location namespaceToRemove : locationsToRemove) { batch.delete(namespaceToRemove).and(); } // Execute all these changes ... batch.execute(); } catch (PathNotFoundException e) { // Nothing stored yet, so do nothing ... } return result; }
/** * This method attempts to create a very small subgraph and then delete all of the nodes in that subgraph, all within the same * batch operation. */ @FixFor( "MODE-788" ) @Test public void shouldCreateAndDeleteTwoNodeSubgraphInSameOperation() { // Look for the root before we do anyting ... Node root = graph.getNodeAt("/"); assertThat(root, is(notNullValue())); assertThat(root, hasProperty(ModeShapeLexicon.UUID, getRootNodeUuid())); assertThat(root.getChildren(), isEmpty()); graph.batch().create("/a").and().create("/a/b").and().delete("/a").and().execute(); // Now look up the root node ... root = graph.getNodeAt("/"); assertThat(root, is(notNullValue())); assertThat(root, hasProperty(ModeShapeLexicon.UUID, getRootNodeUuid())); assertThat(root.getChildren(), isEmpty()); }
/** * Request to delete the node with the given identification properties. 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 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 BatchConjunction delete( Property firstIdProperty, Property... additionalIdProperties ) { return delete(Location.create(firstIdProperty, additionalIdProperties)); }
/** * Request to delete the node with the given identification properties. 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 property of the node that is to be copied * @return an object that may be used to start another request */ public BatchConjunction delete( Iterable<Property> idProperties ) { return delete(Location.create(idProperties)); }
/** * Request to delete the node at the given path. * <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 path of the node that is to be deleted * @return an object that may be used to start another request */ public BatchConjunction delete( Path at ) { return delete(Location.create(at)); }
/** * 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()); }
/** * Request to delete the node at the given path. * <p> * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is * called. * </p> * * @param atPath the path of the node that is to be deleted * @return an object that may be used to start another request */ public BatchConjunction delete( String atPath ) { return delete(Location.create(createPath(atPath))); }
/** * This method attempts to create a small subgraph and then delete all of the nodes in that subgraph, all within the same * batch operation. */ @FixFor( "MODE-788" ) @Test public void shouldCreateAndDeleteNodeInSameOperation() { graph.batch().create("/a").with("propB", "valueB").and("propC", "valueC").and().delete("/a").and().execute(); }
/** * Request to delete the node with the given unique identification property. * <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 identifying property of the node that is to be deleted * @return an object that may be used to start another request */ public BatchConjunction delete( Property idProperty ) { return delete(Location.create(idProperty)); }
/** * Request to delete the node with the given UUID. * <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 UUID of the node that is to be deleted * @return an object that may be used to start another request */ public BatchConjunction delete( UUID at ) { return delete(Location.create(at)); }
@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(); }