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);
}
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);
}
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);
}
Aggregations