Search in sources :

Example 1 with RelationshipChainPosition

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

the class ReadTransaction method getRelationshipChainPosition.

public RelationshipChainPosition getRelationshipChainPosition(long nodeId) {
    NodeRecord nodeRecord = getNodeStore().getRecord(nodeId);
    long nextRel = nodeRecord.getNextRel();
    return new RelationshipChainPosition(nextRel);
}
Also used : NodeRecord(org.neo4j.kernel.impl.nioneo.store.NodeRecord) RelationshipChainPosition(org.neo4j.kernel.impl.nioneo.store.RelationshipChainPosition)

Example 2 with RelationshipChainPosition

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

the class WriteTransaction method getRelationshipChainPosition.

public RelationshipChainPosition getRelationshipChainPosition(long nodeId) {
    NodeRecord nodeRecord = getNodeRecord(nodeId);
    if (nodeRecord != null && nodeRecord.isCreated()) {
        return new RelationshipChainPosition(Record.NO_NEXT_RELATIONSHIP.intValue());
    }
    nodeRecord = getNodeStore().getRecord(nodeId);
    long nextRel = nodeRecord.getNextRel();
    return new RelationshipChainPosition(nextRel);
}
Also used : NodeRecord(org.neo4j.kernel.impl.nioneo.store.NodeRecord) RelationshipChainPosition(org.neo4j.kernel.impl.nioneo.store.RelationshipChainPosition)

Example 3 with RelationshipChainPosition

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

the class NodeManager method getMoreRelationships.

Pair<ArrayMap<String, RelIdArray>, Map<Long, RelationshipImpl>> getMoreRelationships(NodeImpl node) {
    long nodeId = node.getId();
    RelationshipChainPosition position = node.getRelChainPosition();
    Iterable<RelationshipData> rels = persistenceManager.getMoreRelationships(nodeId, position);
    ArrayMap<String, RelIdArray> newRelationshipMap = new ArrayMap<String, RelIdArray>();
    Map<Long, RelationshipImpl> relsMap = new HashMap<Long, RelationshipImpl>(150);
    for (RelationshipData rel : rels) {
        long relId = rel.getId();
        RelationshipImpl relImpl = relCache.get(relId);
        RelationshipType type = null;
        if (relImpl == null) {
            type = getRelationshipTypeById(rel.relationshipType());
            assert type != null;
            relImpl = new RelationshipImpl(relId, rel.firstNode(), rel.secondNode(), type, false);
            relsMap.put(relId, relImpl);
        // relCache.put( relId, relImpl );
        } else {
            type = relImpl.getType();
        }
        RelIdArray relationshipSet = newRelationshipMap.get(type.name());
        if (relationshipSet == null) {
            relationshipSet = new RelIdArray();
            newRelationshipMap.put(type.name(), relationshipSet);
        }
        relationshipSet.add(relId);
    }
    // relCache.putAll( relsMap );
    return Pair.of(newRelationshipMap, relsMap);
}
Also used : RelationshipChainPosition(org.neo4j.kernel.impl.nioneo.store.RelationshipChainPosition) HashMap(java.util.HashMap) RelationshipType(org.neo4j.graphdb.RelationshipType) ArrayMap(org.neo4j.kernel.impl.util.ArrayMap) RelationshipData(org.neo4j.kernel.impl.nioneo.store.RelationshipData) RelIdArray(org.neo4j.kernel.impl.util.RelIdArray)

Aggregations

RelationshipChainPosition (org.neo4j.kernel.impl.nioneo.store.RelationshipChainPosition)3 NodeRecord (org.neo4j.kernel.impl.nioneo.store.NodeRecord)2 HashMap (java.util.HashMap)1 RelationshipType (org.neo4j.graphdb.RelationshipType)1 RelationshipData (org.neo4j.kernel.impl.nioneo.store.RelationshipData)1 ArrayMap (org.neo4j.kernel.impl.util.ArrayMap)1 RelIdArray (org.neo4j.kernel.impl.util.RelIdArray)1