@Override public void relationshipDelete(final KernelStatement state, long relationshipId) throws EntityNotFoundException { assertRelationshipExists(state, relationshipId); // NOTE: We implicitly delegate to neoStoreTransaction via txState.legacyState here. This is // because that // call returns modified properties, which node manager uses to update legacy tx state. This // will be cleaned up // once we've removed legacy tx state. legacyPropertyTrackers.relationshipDelete(relationshipId); final TransactionState txState = state.txState(); if (txState.relationshipIsAddedInThisTx(relationshipId)) { txState.relationshipDoDeleteAddedInThisTx(relationshipId); } else { try { storeLayer.relationshipVisit( relationshipId, new RelationshipVisitor<RuntimeException>() { @Override public void visit(long relId, int type, long startNode, long endNode) { txState.relationshipDoDelete(relId, type, startNode, endNode); } }); } catch (EntityNotFoundException e) { // If it doesn't exist, it doesn't exist, and the user got what she wanted. return; } } }
// <Legacy index> @Override public <EXCEPTION extends Exception> void relationshipVisit( KernelStatement statement, long relId, RelationshipVisitor<EXCEPTION> visitor) throws EntityNotFoundException, EXCEPTION { if (statement.hasTxStateWithChanges()) { if (statement.txState().relationshipVisit(relId, visitor)) { return; } } storeLayer.relationshipVisit(relId, visitor); }