patch operation for ncmp running
[cps.git] / cps-ncmp-rest / src / main / java / org / onap / cps / ncmp / rest / controller / NetworkCmProxyController.java
index 28bb28c..a6b09e8 100755 (executable)
@@ -62,6 +62,7 @@ import org.springframework.web.bind.annotation.RestController;
 public class NetworkCmProxyController implements NetworkCmProxyApi {
 
     private static final Gson GSON = new GsonBuilder().create();
+    private static final String NO_BODY = null;
 
     private final ModelMapper modelMapper = new ModelMapper();
     private final NetworkCmProxyDataService networkCmProxyDataService;
@@ -78,6 +79,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      * Create Node.
      * @deprecated This Method is no longer used as part of NCMP.
      */
+    // All deprecated APIs methods will be address into https://jira.onap.org/browse/CPS-642
     @Override
     @Deprecated(forRemoval = false)
     public ResponseEntity<Void> createNode(final String cmHandle, @Valid final Object jsonData,
@@ -90,6 +92,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      * Add List-node Child Element.
      * @deprecated This Method is no longer used as part of NCMP.
      */
+    // All deprecated APIs methods will be address into https://jira.onap.org/browse/CPS-642
     @Override
     @Deprecated(forRemoval = false)
     public ResponseEntity<Void> addListNodeElements(@NotNull @Valid final String parentNodeXpath,
@@ -102,6 +105,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      * Get Node By CM Handle and X-Path.
      * @deprecated This Method is no longer used as part of NCMP.
      */
+    // All deprecated APIs methods will be address into https://jira.onap.org/browse/CPS-642
     @Override
     @Deprecated(forRemoval = false)
     public ResponseEntity<Object> getNodeByCmHandleAndXpath(final String cmHandle, @Valid final String xpath,
@@ -116,6 +120,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      * Query Data Nodes.
      * @deprecated This Method is no longer used as part of NCMP.
      */
+    // All deprecated APIs methods will be address into https://jira.onap.org/browse/CPS-642
     @Override
     @Deprecated(forRemoval = false)
     public ResponseEntity<Object> queryNodesByCmHandleAndCpsPath(final String cmHandle, @Valid final String cpsPath,
@@ -131,6 +136,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      * Replace Node With Descendants.
      * @deprecated This Method is no longer used as part of NCMP.
      */
+    // All deprecated APIs methods will be address into https://jira.onap.org/browse/CPS-642
     @Override
     @Deprecated(forRemoval = false)
     public ResponseEntity<Object> replaceNode(final String cmHandle, @Valid final Object jsonData,
@@ -143,6 +149,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      * Update Node Leaves.
      * @deprecated This Method is no longer used as part of NCMP.
      */
+    // All deprecated APIs methods will be address into https://jira.onap.org/browse/CPS-642
     @Override
     @Deprecated(forRemoval = false)
     public ResponseEntity<Object> updateNodeLeaves(final String cmHandle, @Valid final Object jsonData,
@@ -197,9 +204,9 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
     public ResponseEntity<Object> patchResourceDataRunningForCmHandle(final String resourceIdentifier,
         final String cmHandle,
         final Object requestBody, final String contentType) {
-        networkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle(cmHandle,
+        final Object responseObject = networkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle(cmHandle,
             resourceIdentifier, PATCH, GSON.toJson(requestBody), contentType);
-        return new ResponseEntity<>(HttpStatus.OK);
+        return ResponseEntity.ok(responseObject);
     }
 
     /**
@@ -244,18 +251,15 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
      *
      * @param resourceIdentifier resource identifier
      * @param cmHandle cm handle identifier
-     * @param requestBody the request body
      * @param contentType content type of the body
      * @return response entity no content if request is successful
      */
     @Override
-    public ResponseEntity<Void> deleteResourceDataRunningForCmHandle(final String resourceIdentifier,
-                                                                     final String cmHandle,
-                                                                     final Object requestBody,
+    public ResponseEntity<Void> deleteResourceDataRunningForCmHandle(final String cmHandle,
+                                                                     final String resourceIdentifier,
                                                                      final String contentType) {
-
         networkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle(cmHandle,
-            resourceIdentifier, DELETE, GSON.toJson(requestBody), contentType);
+            resourceIdentifier, DELETE, NO_BODY, contentType);
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }