From 426c879645116e22acce507d8e02866944fa0f1c Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Tue, 15 Oct 2024 12:11:16 +0100 Subject: Added additional logging - Added logging for non existing xpath while updating data notes and its decendants. Issue-ID: CPS-2403 Change-Id: I1ecaf2aed77aec8d266f6a758fe80ee96717d9c7 Signed-off-by: sourabh_sourabh --- .../org/onap/cps/ri/CpsDataPersistenceServiceImpl.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cps-ri/src/main/java') diff --git a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java index ee555f7dc8..ecbe447226 100644 --- a/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java @@ -228,6 +228,9 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService final Collection xpaths = xpathToUpdatedDataNode.keySet(); Collection existingFragmentEntities = getFragmentEntities(anchorEntity, xpaths); + + logMissingXPaths(xpaths, existingFragmentEntities); + existingFragmentEntities = fragmentRepository.prefetchDescendantsOfFragmentEntities( FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS, existingFragmentEntities); @@ -243,6 +246,19 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService } } + private void logMissingXPaths(final Collection xpaths, final Collection + existingFragmentEntities) { + final Set existingXPaths = existingFragmentEntities.stream().map(FragmentEntity::getXpath) + .collect(Collectors.toSet()); + + final Set missingXPaths = xpaths.stream().filter(xpath -> !existingXPaths.contains(xpath)) + .collect(Collectors.toSet()); + + if (!missingXPaths.isEmpty()) { + log.warn("Cannot update data nodes: Target XPaths {} not found in DB.", missingXPaths); + } + } + private void retryUpdateDataNodesIndividually(final AnchorEntity anchorEntity, final Collection fragmentEntities) { final Collection failedXpaths = new HashSet<>(); -- cgit 1.2.3-korg