aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java/org/onap
diff options
context:
space:
mode:
authorToine Siebelink <toine.siebelink@est.tech>2023-10-10 15:09:03 +0000
committerGerrit Code Review <gerrit@onap.org>2023-10-10 15:09:03 +0000
commitcad3a2f2c4850a3ab811b03ea606cad872199fb5 (patch)
treec6eb5791e4246bd511d454519267b48a2471c895 /cps-service/src/main/java/org/onap
parent02ce57c4324b0e465daa9f20538417874f449ad6 (diff)
parentd8620d2bceab3001543d795b3d44925377d00cf1 (diff)
Merge "JSON list support when updating multiple datanodes"
Diffstat (limited to 'cps-service/src/main/java/org/onap')
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java27
1 files changed, 6 insertions, 21 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
index 7db87e87ea..1d68450f8a 100755
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
@@ -31,6 +31,7 @@ import static org.onap.cps.notification.Operation.UPDATE;
import io.micrometer.core.annotation.Timed;
import java.io.Serializable;
import java.time.OffsetDateTime;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
@@ -321,28 +322,12 @@ public class CpsDataServiceImpl implements CpsDataService {
processDataUpdatedEventAsync(anchor, listNodeXpath, DELETE, observedTimestamp);
}
- private DataNode buildDataNode(final Anchor anchor, final String parentNodeXpath, final String nodeData,
- final ContentType contentType) {
- final SchemaContext schemaContext = getSchemaContext(anchor);
-
- if (ROOT_NODE_XPATH.equals(parentNodeXpath)) {
- final ContainerNode containerNode = timedYangParser.parseData(contentType, nodeData, schemaContext);
- return new DataNodeBuilder().withContainerNode(containerNode).build();
- }
-
- final ContainerNode containerNode =
- timedYangParser.parseData(contentType, nodeData, schemaContext, parentNodeXpath);
-
- return new DataNodeBuilder()
- .withParentNodeXpath(parentNodeXpath)
- .withContainerNode(containerNode)
- .build();
- }
-
private Collection<DataNode> buildDataNodes(final Anchor anchor, final Map<String, String> nodesJsonData) {
- return nodesJsonData.entrySet().stream().map(nodeJsonData ->
- buildDataNode(anchor, nodeJsonData.getKey(),
- nodeJsonData.getValue(), ContentType.JSON)).collect(Collectors.toList());
+ final Collection<DataNode> dataNodes = new ArrayList<>();
+ for (final Map.Entry<String, String> nodeJsonData : nodesJsonData.entrySet()) {
+ dataNodes.addAll(buildDataNodes(anchor, nodeJsonData.getKey(), nodeJsonData.getValue(), ContentType.JSON));
+ }
+ return dataNodes;
}
private Collection<DataNode> buildDataNodes(final Anchor anchor, final String parentNodeXpath,