diff options
Diffstat (limited to 'cps-rest/src/main/java/org')
-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); + } } |