Search in sources :

Example 1 with NodeStore

use of org.neo4j.kernel.impl.nioneo.store.NodeStore in project graphdb by neo4j-attic.

the class BatchInserterImpl method createNode.

public void createNode(long id, Map<String, Object> properties) {
    if (id < 0 || id > MAX_NODE_ID) {
        throw new IllegalArgumentException("id=" + id);
    }
    if (id == IdGeneratorImpl.INTEGER_MINUS_ONE) {
        throw new IllegalArgumentException("id " + id + " is reserved for internal use");
    }
    long nodeId = id;
    NodeStore nodeStore = neoStore.getNodeStore();
    if (neoStore.getNodeStore().loadLightNode(nodeId)) {
        throw new IllegalArgumentException("id=" + id + " already in use");
    }
    long highId = nodeStore.getHighId();
    if (highId <= id) {
        nodeStore.setHighId(nodeId + 1);
    }
    NodeRecord nodeRecord = new NodeRecord(nodeId);
    nodeRecord.setInUse(true);
    nodeRecord.setCreated();
    nodeRecord.setNextProp(createPropertyChain(properties));
    getNodeStore().updateRecord(nodeRecord);
}
Also used : NodeRecord(org.neo4j.kernel.impl.nioneo.store.NodeRecord) NodeStore(org.neo4j.kernel.impl.nioneo.store.NodeStore)

Example 2 with NodeStore

use of org.neo4j.kernel.impl.nioneo.store.NodeStore in project neo4j-mobile-android by neo4j-contrib.

the class BatchInserterImpl method createNode.

public void createNode(long id, Map<String, Object> properties) {
    if (id < 0 || id > MAX_NODE_ID) {
        throw new IllegalArgumentException("id=" + id);
    }
    if (id == IdGeneratorImpl.INTEGER_MINUS_ONE) {
        throw new IllegalArgumentException("id " + id + " is reserved for internal use");
    }
    long nodeId = id;
    NodeStore nodeStore = neoStore.getNodeStore();
    if (neoStore.getNodeStore().loadLightNode(nodeId)) {
        throw new IllegalArgumentException("id=" + id + " already in use");
    }
    long highId = nodeStore.getHighId();
    if (highId <= id) {
        nodeStore.setHighId(nodeId + 1);
    }
    NodeRecord nodeRecord = new NodeRecord(nodeId);
    nodeRecord.setInUse(true);
    nodeRecord.setCreated();
    nodeRecord.setNextProp(createPropertyChain(properties));
    getNodeStore().updateRecord(nodeRecord);
}
Also used : NodeRecord(org.neo4j.kernel.impl.nioneo.store.NodeRecord) NodeStore(org.neo4j.kernel.impl.nioneo.store.NodeStore)

Aggregations

NodeRecord (org.neo4j.kernel.impl.nioneo.store.NodeRecord)2 NodeStore (org.neo4j.kernel.impl.nioneo.store.NodeStore)2