internal virtual void CheckRemoved <T>(IDictionary <T, IDictionary <string, PropertyEntryImpl <T> > > map, PropertyEntry <T> entry) where T : Org.Neo4j.Graphdb.PropertyContainer { PropertyEntryImpl <T> expected = FetchExpectedPropertyEntry(map, entry); if (expected != null) { // To handle the ignore flag (read above) expected.CompareToRemoved(entry); } }
internal virtual void AssignedProperty(Relationship rel, string key, object value, object valueBeforeTx) { valueBeforeTx = RemoveProperty(ExpectedRemovedRelationshipProperties, rel, key, valueBeforeTx); if (!value.Equals(valueBeforeTx)) { IDictionary <string, PropertyEntryImpl <Relationship> > map = ExpectedAssignedRelationshipProperties[rel]; PropertyEntryImpl <Relationship> prev = map[key]; map[key] = Property(rel, key, value, prev != null ? prev.PreviouslyCommitedValue() : valueBeforeTx); } }
internal virtual void AssignedProperty(Node node, string key, object value, object valueBeforeTx) { valueBeforeTx = RemoveProperty(ExpectedRemovedNodeProperties, node, key, valueBeforeTx); if (!value.Equals(valueBeforeTx)) { IDictionary <string, PropertyEntryImpl <Node> > map = ExpectedAssignedNodeProperties[node]; PropertyEntryImpl <Node> prev = map[key]; map[key] = Property(node, key, value, prev != null ? prev.PreviouslyCommitedValue() : valueBeforeTx); } }
/// <returns> {@code non-null} if this property should be expected to come as removed property in the event </returns> private object RemoveProperty <E>(IDictionary <E, IDictionary <string, PropertyEntryImpl <E> > > map, E entity, string key, object valueBeforeTx) where E : Org.Neo4j.Graphdb.PropertyContainer { if (map.ContainsKey(entity)) { IDictionary <string, PropertyEntryImpl <E> > inner = map[entity]; PropertyEntryImpl <E> entry = inner.Remove(key); if (entry == null) { // this means that we've been called to remove an existing property return(valueBeforeTx); } if (inner.Count == 0) { map.Remove(entity); } if (entry.PreviouslyCommitedValue() != null) { // this means that we're removing a previously changed property, i.e. there's a value to remove return(entry.PreviouslyCommitedValue()); } return(null); } return(valueBeforeTx); }
internal virtual PropertyEntryImpl <T> FetchExpectedPropertyEntry <T>(IDictionary <T, IDictionary <string, PropertyEntryImpl <T> > > map, PropertyEntry <T> entry) where T : Org.Neo4j.Graphdb.PropertyContainer { T entity = entry.Entity(); bool hasEntity = map.ContainsKey(entity); if (_ignoreAdditionalData && !hasEntity) { return(null); } assertTrue("Unexpected entity " + entry, hasEntity); IDictionary <string, PropertyEntryImpl <T> > innerMap = map[entity]; PropertyEntryImpl <T> expectedEntry = innerMap.Remove(entry.Key()); if (expectedEntry == null && _ignoreAdditionalData) { return(null); } assertNotNull("Unexpected property entry " + entry, expectedEntry); if (innerMap.Count == 0) { map.Remove(entity); } return(expectedEntry); }