diff options
author | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2021-02-09 17:25:18 +0200 |
---|---|---|
committer | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2021-02-18 11:54:36 +0200 |
commit | 24c72db6b3674bde16eb5a7313d71f507a880de9 (patch) | |
tree | c6eb5a55e544954782cc0fdab820c26ed81ed8d2 /cps-rest/src/main | |
parent | 6d13f166f2e3d1c357677ad6f37f6e35238aeac6 (diff) |
Data fragment update by xpath #3 - rest and service layers
Issue-ID: CPS-58
Change-Id: Ie224da95b07748b63648226df6484cebae91cdec
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-rest/src/main')
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java index c39a9696e3..8366f06b38 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java @@ -54,15 +54,29 @@ public class DataRestController implements CpsDataApi { @Override public ResponseEntity<Object> getNodeByDataspaceAndAnchor(final String dataspaceName, final String anchorName, - final String cpsPath, final Boolean includeDescendants) { - if ("/".equals(cpsPath)) { + final String xpath, final Boolean includeDescendants) { + if ("/".equals(xpath)) { // TODO: extracting data by anchor only (root data node and below) return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } final FetchDescendantsOption fetchDescendantsOption = Boolean.TRUE.equals(includeDescendants) ? FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS : FetchDescendantsOption.OMIT_DESCENDANTS; final DataNode dataNode = - cpsDataService.getDataNode(dataspaceName, anchorName, cpsPath, fetchDescendantsOption); + cpsDataService.getDataNode(dataspaceName, anchorName, xpath, fetchDescendantsOption); return new ResponseEntity<>(DataMapUtils.toDataMap(dataNode), HttpStatus.OK); } + + @Override + public ResponseEntity<Object> updateNodeLeaves(final String jsonData, final String dataspaceName, + final String anchorName, final String parentNodeXpath) { + cpsDataService.updateNodeLeaves(dataspaceName, anchorName, parentNodeXpath, jsonData); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Override + public ResponseEntity<Object> replaceNode(final String jsonData, final String dataspaceName, + final String anchorName, final String parentNodeXpath) { + cpsDataService.replaceNodeTree(dataspaceName, anchorName, parentNodeXpath, jsonData); + return new ResponseEntity<>(HttpStatus.OK); + } } |