diff options
Diffstat (limited to 'cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java b/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java index 42719d9b3..ff5204ff6 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java +++ b/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Pantheon.tech - * Modifications (C) 2021 Nordix Foundation + * Modifications (C) 2021-2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public class DataMapUtils { */ public static Map<String, Object> toDataMapWithIdentifier(final DataNode dataNode) { return ImmutableMap.<String, Object>builder() - .put(getNodeIdentifier(dataNode.getXpath()), toDataMap(dataNode)) + .put(getNodeIdentifierWithPrefix(dataNode.getXpath(), dataNode.getModuleNamePrefix()), toDataMap(dataNode)) .build(); } @@ -96,6 +96,13 @@ public class DataMapUtils { return toIndex > 0 ? xpath.substring(fromIndex, toIndex) : xpath.substring(fromIndex); } + private static String getNodeIdentifierWithPrefix(final String xpath, final String moduleNamePrefix) { + if (moduleNamePrefix != null) { + return moduleNamePrefix + ":" + getNodeIdentifier(xpath); + } + return getNodeIdentifier(xpath); + } + private static boolean isContainerNode(final String xpath) { return !isListElement(xpath); } |