List<RelTypeElementIterator> getAllRelationships(NodeManager nodeManager) { ensureRelationshipMapNotNull(nodeManager); List<RelTypeElementIterator> relTypeList = new LinkedList<RelTypeElementIterator>(); boolean hasModifications = nodeManager.getLockReleaser().hasRelationshipModifications(this); ArrayMap<String, RelIdArray> addMap = null; if (hasModifications) { addMap = nodeManager.getCowRelationshipAddMap(this); } for (String type : relationshipMap.keySet()) { RelIdArray src = relationshipMap.get(type); RelIdArray remove = null; RelIdArray add = null; if (hasModifications) { remove = nodeManager.getCowRelationshipRemoveMap(this, type); if (addMap != null) { add = addMap.get(type); } } // if ( src != null || add != null ) // { relTypeList.add(RelTypeElement.create(type, this, src, add, remove)); // } } if (addMap != null) { for (String type : addMap.keySet()) { if (relationshipMap.get(type) == null) { RelIdArray remove = nodeManager.getCowRelationshipRemoveMap(this, type); RelIdArray add = addMap.get(type); relTypeList.add(RelTypeElement.create(type, this, null, add, remove)); } } } return relTypeList; }
List<RelTypeElementIterator> getAllRelationshipsOfType( NodeManager nodeManager, RelationshipType... types) { ensureRelationshipMapNotNull(nodeManager); List<RelTypeElementIterator> relTypeList = new LinkedList<RelTypeElementIterator>(); boolean hasModifications = nodeManager.getLockReleaser().hasRelationshipModifications(this); for (RelationshipType type : types) { RelIdArray src = relationshipMap.get(type.name()); RelIdArray remove = null; RelIdArray add = null; if (hasModifications) { remove = nodeManager.getCowRelationshipRemoveMap(this, type.name()); add = nodeManager.getCowRelationshipAddMap(this, type.name()); } // if ( src != null || add != null ) // { relTypeList.add(RelTypeElement.create(type.name(), this, src, add, remove)); // } } return relTypeList; }