summaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src/main/java/org/onap')
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/CpsDataService.java16
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java14
2 files changed, 25 insertions, 5 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java b/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java
index d2482d50a6..cdd417bd8d 100644
--- a/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java
+++ b/cps-service/src/main/java/org/onap/cps/api/CpsDataService.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2022 Nordix Foundation
* Modifications Copyright (C) 2021 Pantheon.tech
* Modifications Copyright (C) 2021-2022 Bell Canada
* ================================================================================
@@ -23,6 +23,7 @@
package org.onap.cps.api;
import java.time.OffsetDateTime;
+import java.util.Collection;
import org.onap.cps.spi.FetchDescendantsOption;
import org.onap.cps.spi.model.DataNode;
@@ -117,6 +118,19 @@ public interface CpsDataService {
OffsetDateTime observedTimestamp);
/**
+ * Replaces list content by removing all existing elements and inserting the given new elements as data nodes
+ * under given parent, anchor and dataspace.
+ *
+ * @param dataspaceName dataspace-name
+ * @param anchorName anchor name
+ * @param parentNodeXpath parent node xpath
+ * @param dataNodes datanodes representing the updated data
+ * @param observedTimestamp observedTimestamp
+ */
+ void replaceListContent(String dataspaceName, String anchorName, String parentNodeXpath,
+ Collection<DataNode> dataNodes, OffsetDateTime observedTimestamp);
+
+ /**
* Deletes data node for given anchor and dataspace.
*
* @param dataspaceName dataspace name
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 af06e5fc13..aae355d507 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
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2022 Nordix Foundation
* Modifications Copyright (C) 2020-2022 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
@@ -118,10 +118,16 @@ public class CpsDataServiceImpl implements CpsDataService {
@Override
public void replaceListContent(final String dataspaceName, final String anchorName, final String parentNodeXpath,
- final String jsonData, final OffsetDateTime observedTimestamp) {
+ final String jsonData, final OffsetDateTime observedTimestamp) {
final Collection<DataNode> newListElements =
- buildDataNodes(dataspaceName, anchorName, parentNodeXpath, jsonData);
- cpsDataPersistenceService.replaceListContent(dataspaceName, anchorName, parentNodeXpath, newListElements);
+ buildDataNodes(dataspaceName, anchorName, parentNodeXpath, jsonData);
+ replaceListContent(dataspaceName, anchorName, parentNodeXpath, newListElements, observedTimestamp);
+ }
+
+ @Override
+ public void replaceListContent(final String dataspaceName, final String anchorName, final String parentNodeXpath,
+ final Collection<DataNode> dataNodes, final OffsetDateTime observedTimestamp) {
+ cpsDataPersistenceService.replaceListContent(dataspaceName, anchorName, parentNodeXpath, dataNodes);
processDataUpdatedEventAsync(dataspaceName, anchorName, observedTimestamp, parentNodeXpath, Operation.UPDATE);
}