From 32446dce35b5bf9d2c84751718cb4ece7f96fa72 Mon Sep 17 00:00:00 2001 From: niamhcore Date: Mon, 1 Mar 2021 13:25:13 +0000 Subject: CPS-265 - updating cps path to support include-descendants option. Issue-ID: CPS-265 Signed-off-by: niamhcore Change-Id: I9e9b84760dbc8b5eb4b31ab972fdb2d186c6bb48 --- .../java/org/onap/cps/rest/controller/QueryRestController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cps-rest/src/main') diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/QueryRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/QueryRestController.java index a8816f02b..c6b5284fb 100644 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/QueryRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/QueryRestController.java @@ -24,6 +24,7 @@ import java.util.Collection; import javax.validation.Valid; import org.onap.cps.api.CpsQueryService; import org.onap.cps.rest.api.CpsQueryApi; +import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.model.DataNode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -40,9 +41,11 @@ public class QueryRestController implements CpsQueryApi { @Override public ResponseEntity getNodesByDataspaceAndAnchorAndCpsPath(final String dataspaceName, - final String anchorName, @Valid final String cpsPath) { + final String anchorName, @Valid final String cpsPath, @Valid final Boolean includeDescendants) { + final FetchDescendantsOption fetchDescendantsOption = Boolean.TRUE.equals(includeDescendants) + ? FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS : FetchDescendantsOption.OMIT_DESCENDANTS; final Collection dataNodes = - cpsQueryService.queryDataNodes(dataspaceName, anchorName, cpsPath); + cpsQueryService.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption); return new ResponseEntity<>(new Gson().toJson(dataNodes), HttpStatus.OK); } } -- cgit 1.2.3-korg