summaryrefslogtreecommitdiffstats
path: root/cps-rest/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'cps-rest/src/main')
-rwxr-xr-xcps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java18
1 files changed, 18 insertions, 0 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 60e7fb6d2d..4f9328b6cd 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
@@ -38,6 +38,7 @@ import org.onap.cps.api.CpsDataService;
import org.onap.cps.rest.api.CpsDataApi;
import org.onap.cps.spi.FetchDescendantsOption;
import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.spi.model.DeltaReport;
import org.onap.cps.utils.ContentType;
import org.onap.cps.utils.DataMapUtils;
import org.onap.cps.utils.JsonObjectMapper;
@@ -166,6 +167,23 @@ public class DataRestController implements CpsDataApi {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
+ @Override
+ @Timed(value = "cps.data.controller.get.delta",
+ description = "Time taken to get delta between anchors")
+ public ResponseEntity<Object> getDeltaByDataspaceAndAnchors(final String dataspaceName,
+ final String sourceAnchorName,
+ final String targetAnchorName,
+ final String xpath,
+ final String descendants) {
+ final FetchDescendantsOption fetchDescendantsOption =
+ FetchDescendantsOption.getFetchDescendantsOption(descendants);
+
+ final List<DeltaReport> deltaBetweenAnchors =
+ cpsDataService.getDeltaByDataspaceAndAnchors(dataspaceName, sourceAnchorName,
+ targetAnchorName, xpath, fetchDescendantsOption);
+ return new ResponseEntity<>(jsonObjectMapper.asJsonString(deltaBetweenAnchors), HttpStatus.OK);
+ }
+
private static boolean isRootXpath(final String xpath) {
return ROOT_XPATH.equals(xpath);
}