diff options
author | mpriyank <priyank.maheshwari@est.tech> | 2022-01-28 16:33:56 +0530 |
---|---|---|
committer | Renu Kumari <renu.kumari@bell.ca> | 2022-02-16 13:31:29 +0000 |
commit | a15c0e5b58f16c3ab4a7c7610ac8c4a191e5e051 (patch) | |
tree | e71d9c9f2c4570e645c96a69212146276792e49d /cps-service | |
parent | 4e1d5e0a179857bfe14296ae1153b2c1173278c8 (diff) |
Core logic to update,add or remove cmHandle properties
Issue-ID: CPS-837
Change-Id: Ia078b6a0291ae916931259a309dd592b0554da28
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-service')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/api/CpsDataService.java | 16 | ||||
-rwxr-xr-x | cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java | 14 |
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); } |