diff options
author | Rudrangi Anupriya <ra00745022@techmahindra.com> | 2024-06-05 23:55:14 +0530 |
---|---|---|
committer | Rudrangi Anupriya <ra00745022@techmahindra.com> | 2024-06-05 23:55:31 +0530 |
commit | 1decb39aa016bdfc7ac870aec738c9c08484c32f (patch) | |
tree | a7d8ddf33a5a57564dd4d37f04644cb997b8f0c7 /cps-rest/src/main/java | |
parent | cfc5f94a00ad352ef44cc745e358f52fc914b3e9 (diff) |
XML content support on update node leaves
Issue-ID: CPS-2071
Change-Id: Ibe7f59fbfcbb03703626132c6d5c2afde0e7ab4b
Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
Diffstat (limited to 'cps-rest/src/main/java')
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java | 10 |
1 files changed, 7 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 4f9328b6cd..310171b309 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 @@ -3,7 +3,7 @@ * Copyright (C) 2020-2022 Bell Canada. * Modifications Copyright (C) 2021 Pantheon.tech * Modifications Copyright (C) 2021-2023 Nordix Foundation - * Modifications Copyright (C) 2022-2023 TechMahindra Ltd. + * Modifications Copyright (C) 2022-2024 TechMahindra Ltd. * Modifications Copyright (C) 2022 Deutsche Telekom AG * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -133,9 +133,13 @@ public class DataRestController implements CpsDataApi { @Override public ResponseEntity<Object> updateNodeLeaves(final String apiVersion, final String dataspaceName, - final String anchorName, final Object jsonData, final String parentNodeXpath, final String observedTimestamp) { + final String anchorName, final String contentTypeHeader, + final String nodeData, final String parentNodeXpath, + final String observedTimestamp) { + final ContentType contentType = contentTypeHeader.contains(MediaType.APPLICATION_XML_VALUE) ? ContentType.XML + : ContentType.JSON; cpsDataService.updateNodeLeaves(dataspaceName, anchorName, parentNodeXpath, - jsonObjectMapper.asJsonString(jsonData), toOffsetDateTime(observedTimestamp)); + nodeData, toOffsetDateTime(observedTimestamp), contentType); return new ResponseEntity<>(HttpStatus.OK); } |