ArrayMap<String, IntArray> getMoreRelationships(NodeImpl node) { int nodeId = (int) node.getId(); RelationshipChainPosition position = node.getRelChainPosition(); Iterable<RelationshipData> rels = persistenceManager.getMoreRelationships(nodeId, position); ArrayMap<String, IntArray> newRelationshipMap = new ArrayMap<String, IntArray>(); for (RelationshipData rel : rels) { int 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, this); relCache.put(relId, relImpl); } else { type = relImpl.getType(); } IntArray relationshipSet = newRelationshipMap.get(type.name()); if (relationshipSet == null) { relationshipSet = new IntArray(); newRelationshipMap.put(type.name(), relationshipSet); } relationshipSet.add(relId); } return newRelationshipMap; }
// caller is responsible for acquiring lock // this method is only called when a undo create relationship or // a relationship delete is invoked. void removeRelationship(NodeManager nodeManager, RelationshipType type, int relId) { IntArray relationshipSet = nodeManager.getCowRelationshipRemoveMap(this, type.name(), true); relationshipSet.add(relId); }