diff options
author | 2022-03-03 14:27:49 +0000 | |
---|---|---|
committer | 2022-03-03 14:27:49 +0000 | |
commit | 41334d39a359adf72dca034eb7ddd7536d04b9c3 (patch) | |
tree | 3d09798eb4c317a111e388860745491427196cb1 /cps-service/src/main/java | |
parent | ad72efeef9f3fb0666182481f77955b2980ec7dd (diff) | |
parent | bb030cb7803d3d08f86de5eb1c6be5ad32f5fbf6 (diff) |
Merge "Bug fix for delete data node not working for root node"
Diffstat (limited to 'cps-service/src/main/java')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/notification/NotificationService.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java b/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java index 5ad59df2a..5e26a2204 100644 --- a/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java +++ b/cps-service/src/main/java/org/onap/cps/notification/NotificationService.java @@ -37,8 +37,6 @@ import org.springframework.stereotype.Service; @Slf4j public class NotificationService { - private static final String ROOT_NODE_XPATH = "/"; - private NotificationProperties notificationProperties; private NotificationPublisher notificationPublisher; private CpsDataUpdatedEventFactory cpsDataUpdatedEventFactory; @@ -120,7 +118,15 @@ public class NotificationService { } private Operation getRootNodeOperation(final String xpath, final Operation operation) { - return ROOT_NODE_XPATH.equals(xpath) ? operation : Operation.UPDATE; + return isRootXpath(xpath) || isRootContainerNodeXpath(xpath) ? operation : Operation.UPDATE; + } + + private static boolean isRootXpath(final String xpath) { + return "/".equals(xpath) || "".equals(xpath); + } + + private static boolean isRootContainerNodeXpath(final String xpath) { + return 0 == xpath.lastIndexOf('/'); } } |