Fix for get cm handle identifiers response body
[cps.git] / cps-ncmp-rest / src / main / java / org / onap / cps / ncmp / rest / controller / NetworkCmProxyController.java
index ca661b8..075b451 100755 (executable)
@@ -132,6 +132,12 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
         return new ResponseEntity<>(HttpStatus.OK);
     }
 
+    @Override
+    public ResponseEntity<Object> updateResourceDataRunningForCmHandle(final String cmHandle,
+        final String resourceIdentifier, final String requestBody, final String contentType) {
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+    }
+
     /**
      * Update Node Leaves.
      * @deprecated This Method is no longer used as part of NCMP.
@@ -211,8 +217,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
         final List<ConditionProperties> conditionProperties =
             conditions.getConditions().stream().collect(Collectors.toList());
         final CmHandles cmHandles = new CmHandles();
-        final Collection<String> cmHandleIdentifiers = processConditions(conditionProperties);
-        cmHandleIdentifiers.forEach(cmHandle -> cmHandles.setCmHandles(toCmHandleProperties(cmHandle)));
+        cmHandles.setCmHandles(toCmHandleProperties(processConditions(conditionProperties)));
         return ResponseEntity.ok(cmHandles);
     }
 
@@ -248,11 +253,13 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
         return moduleNames;
     }
 
-    private CmHandleProperties toCmHandleProperties(final String cmHandleId) {
+    private CmHandleProperties toCmHandleProperties(final Collection<String> cmHandleIdentifiers) {
         final CmHandleProperties cmHandleProperties = new CmHandleProperties();
-        final CmHandleProperty cmHandleProperty = new CmHandleProperty();
-        cmHandleProperty.setCmHandleId(cmHandleId);
-        cmHandleProperties.add(cmHandleProperty);
+        for (final String cmHandleIdentifier : cmHandleIdentifiers) {
+            final CmHandleProperty cmHandleProperty = new CmHandleProperty();
+            cmHandleProperty.setCmHandleId(cmHandleIdentifier);
+            cmHandleProperties.add(cmHandleProperty);
+        }
         return cmHandleProperties;
     }