private void populateCreatedNodes(PrimitiveElement element, TransactionDataImpl result) { for (Long nodeId : getCreatedNodes()) { if (element != null) { CowNodeElement nodeElement = element.nodes.get(nodeId); if (nodeElement != null && nodeElement.isDeleted()) { continue; } } result.created(nodeManager.newNodeProxyById(nodeId)); } }
private void populateNodeRelEvent(PrimitiveElement element, TransactionDataImpl result) { for (long nodeId : element.nodes.keySet()) { CowNodeElement nodeElement = element.nodes.get(nodeId); NodeProxy node = nodeManager.newNodeProxyById(nodeId); NodeImpl nodeImpl = nodeManager.getNodeForProxy(nodeId, null); if (nodeElement.isDeleted()) { if (primitiveElement.createdNodes.contains(nodeId)) { continue; } result.deleted(node); } if (nodeElement.relationshipAddMap != null && !nodeElement.isDeleted()) { for (Integer type : nodeElement.relationshipAddMap.keySet()) { RelIdArray createdRels = nodeElement.relationshipAddMap.get(type); populateNodeRelEvent(element, result, nodeId, createdRels); } } if (nodeElement.relationshipRemoveMap != null) { for (Integer type : nodeElement.relationshipRemoveMap.keySet()) { Collection<Long> deletedRels = nodeElement.relationshipRemoveMap.get(type); for (long relId : deletedRels) { if (primitiveElement.createdRelationships.contains(relId)) { continue; } RelationshipProxy rel = nodeManager.newRelationshipProxyById(relId); if (rel.getStartNode().getId() == nodeId) { result.deleted(nodeManager.newRelationshipProxyById(relId)); } } } } if (nodeElement.propertyAddMap != null && !nodeElement.isDeleted()) { for (DefinedProperty data : nodeElement.propertyAddMap.values()) { String key = nodeManager.getKeyForProperty(data); Object oldValue = nodeImpl.getCommittedPropertyValue(nodeManager, key); Object newValue = data.value(); result.assignedProperty(node, key, newValue, oldValue); } } if (nodeElement.propertyRemoveMap != null) { for (DefinedProperty data : nodeElement.propertyRemoveMap.values()) { String key = nodeManager.getKeyForProperty(data); Object oldValue = data.value(); if (oldValue == null && !nodeElement.isDeleted()) { nodeImpl.getCommittedPropertyValue(nodeManager, key); } result.removedProperty(node, key, oldValue); } } } }