diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2024-10-15 12:11:16 +0100 |
---|---|---|
committer | sourabh_sourabh <sourabh.sourabh@est.tech> | 2024-10-15 14:38:51 +0100 |
commit | 426c879645116e22acce507d8e02866944fa0f1c (patch) | |
tree | 2352e8cda8496ed3d723612ca5309c4f6ac584c9 /cps-ri/src/main/java | |
parent | 2e6504ce4fd8bb6f845883729be2b0d9385e71f7 (diff) |
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 <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ri/src/main/java')
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java | 16 |
1 files changed, 16 insertions, 0 deletions
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<String> xpaths = xpathToUpdatedDataNode.keySet(); Collection<FragmentEntity> 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<String> xpaths, final Collection<FragmentEntity> + existingFragmentEntities) { + final Set<String> existingXPaths = existingFragmentEntities.stream().map(FragmentEntity::getXpath) + .collect(Collectors.toSet()); + + final Set<String> 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<FragmentEntity> fragmentEntities) { final Collection<String> failedXpaths = new HashSet<>(); |