Package org.neo4j.kernel.impl.core

Examples of org.neo4j.kernel.impl.core.NodeManager


    }

    @Test public void testUserAddRemove() {
        service.setPermissionForUser("user1", RO);

        NodeManager nodeManager = graphDatabase.getDependencyResolver().resolveDependency(NodeManager.class);
        PropertyContainer properties = nodeManager.getGraphProperties();
        Transaction transaction = graphDatabase.beginTx();
        properties.setProperty("any other property", "should be ignored");
        transaction.success();
        transaction.finish();
View Full Code Here


            tx.finish();
        }
    }

    private PropertyContainer getGraphProperties() {
            NodeManager nodeManager = graph.getDependencyResolver().resolveDependency(NodeManager.class);
            return nodeManager.getGraphProperties();
    }
View Full Code Here

        }
    }

    private static void removeNodes(GraphDatabaseService graphDatabaseService, boolean includeReferenceNode) {
        GraphDatabaseAPI api = (GraphDatabaseAPI) graphDatabaseService;
        NodeManager nodeManager = api.getDependencyResolver().resolveDependency(NodeManager.class);
        final GlobalGraphOperations globalGraphOperations = GlobalGraphOperations.at(graphDatabaseService);
        for (Node node : globalGraphOperations.getAllNodes()) {
            for (Relationship rel : node.getRelationships(Direction.OUTGOING)) {
                try {
                    if (nodeManager.isDeleted(rel)) continue;
                    rel.delete();
                } catch(IllegalStateException ise) {
                    if (!ise.getMessage().contains("since it has already been deleted")) throw ise;
                }

            }
            for (Label label: node.getLabels()) {
                node.removeLabel(label);
            }
        }
        for (Node node : globalGraphOperations.getAllNodes()) {
            try {
                if (nodeManager.isDeleted(node)) continue;
                node.delete();
            } catch(IllegalStateException ise) {
                if (!ise.getMessage().contains("since it has already been deleted")) throw ise;
            }
        }
View Full Code Here

    @Test
    public void testIdUsageInfo()
    {
        GraphDbModule graphDbModule = ((EmbeddedGraphDatabase) getGraphDb()).getConfig()
            .getGraphDbModule();
        NodeManager nm = graphDbModule.getNodeManager();
        long nodeCount = nm.getNumberOfIdsInUse( Node.class );
        long relCount = nm.getNumberOfIdsInUse( Relationship.class );
        if ( nodeCount > nm.getHighestPossibleIdInUse( Node.class ) )
        {
            // fail( "Node count greater than highest id " + nodeCount );
        }
        if ( relCount > nm.getHighestPossibleIdInUse( Relationship.class ) )
        {
            // fail( "Rel count greater than highest id " + relCount );
        }
        // assertTrue( nodeCount <= nm.getHighestPossibleIdInUse( Node.class )
        // );
        // assertTrue( relCount <= nm.getHighestPossibleIdInUse(
        // Relationship.class ) );
        Node n1 = nm.createNode();
        Node n2 = nm.createNode();
        Relationship r1 = n1.createRelationshipTo( n2, MyRelTypes.TEST );
        // assertEquals( nodeCount + 2, nm.getNumberOfIdsInUse( Node.class ) );
        // assertEquals( relCount + 1, nm.getNumberOfIdsInUse(
        // Relationship.class ) );
        r1.delete();
View Full Code Here

TOP

Related Classes of org.neo4j.kernel.impl.core.NodeManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.