From 27f056a6e8a949baab01dac17483a425eaf15377 Mon Sep 17 00:00:00 2001 From: Doris Lam Date: Sat, 30 Mar 2024 22:46:17 -0700 Subject: [PATCH] only further process transacted elements but keep other existing info from passed in nodeChangeInfo --- .../domain/FederatedNodeChangeDomain.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/federatedpersistence/src/main/java/org/openmbee/mms/federatedpersistence/domain/FederatedNodeChangeDomain.java b/federatedpersistence/src/main/java/org/openmbee/mms/federatedpersistence/domain/FederatedNodeChangeDomain.java index e486a0393..1d4ecc866 100644 --- a/federatedpersistence/src/main/java/org/openmbee/mms/federatedpersistence/domain/FederatedNodeChangeDomain.java +++ b/federatedpersistence/src/main/java/org/openmbee/mms/federatedpersistence/domain/FederatedNodeChangeDomain.java @@ -267,10 +267,12 @@ public void primeNodeChangeInfo(NodeChangeInfo nodeChangeInfo, Collection indexIds = Optional.ofNullable(info.getReqIndexIds()).orElse(new HashSet<>()); Map existingNodeMap = Optional.ofNullable(info.getExistingNodeMap()).orElse(new HashMap<>()); - Map reqElementMap = Optional.ofNullable(info.getReqElementMap()).orElse(new HashMap<>()); + Map reqElementMap = new HashMap<>(); // don't add to any existing since this change processing is only for transactedElements Map existingElementMap = Optional.ofNullable(info.getExistingElementMap()).orElse(new HashMap<>()); + Set transactedIndexIds = new HashSet<>(); for (Node node : existingNodes) { + transactedIndexIds.add(node.getDocId()); indexIds.add(node.getDocId()); existingNodeMap.put(node.getNodeId(), node); } @@ -279,7 +281,7 @@ public void primeNodeChangeInfo(NodeChangeInfo nodeChangeInfo, Collection existingElements = nodeIndex.findAllById(indexIds); + List existingElements = nodeIndex.findAllById(transactedIndexIds); existingElementMap.putAll(convertJsonToMap(existingElements)); info.setExistingElementMap(existingElementMap);