aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
authorseanbeirne <sean.beirne@est.tech>2023-02-23 15:16:38 +0000
committerseanbeirne <sean.beirne@est.tech>2023-03-02 15:48:03 +0000
commite3ce81a541ace7a7aeef78d8513e1b171aacb051 (patch)
treeeeeaec18b1b4a7bbbc3f0dd1d207e92e86d4cac8 /cps-ncmp-rest
parentceda6a0b4aa498ae236092cf36d396c004c61cd7 (diff)
Refactor cmHandle(ID) queries
- first execute cm-handle id search only - get cm handles for ids only when needed using multiple-get-method - use Collection interface where posisble (instead of Set) - use java Function to combine multiple queries in a more genric way Issue-ID: CPS-1494 Signed-off-by: seanbeirne <sean.beirne@est.tech> Change-Id: Icfcb8ec94f75e261303aaee5c9034b920c01f3c4
Diffstat (limited to 'cps-ncmp-rest')
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java9
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java6
2 files changed, 8 insertions, 7 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 9f171f6094..4da251f3cc 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2021 highstreet technologies GmbH
* Modifications Copyright (C) 2021-2022 Bell Canada
* ================================================================================
@@ -28,8 +28,8 @@ import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum
import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.PATCH;
import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.UPDATE;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -235,7 +235,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
final CmHandleQueryParameters cmHandleQueryParameters) {
final CmHandleQueryApiParameters cmHandleQueryApiParameters =
deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
- final Set<NcmpServiceCmHandle> cmHandles = networkCmProxyDataService
+ final Collection<NcmpServiceCmHandle> cmHandles = networkCmProxyDataService
.executeCmHandleSearch(cmHandleQueryApiParameters);
final List<RestOutputCmHandle> outputCmHandles =
cmHandles.stream().map(this::toRestOutputCmHandle).collect(Collectors.toList());
@@ -253,7 +253,8 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
final CmHandleQueryParameters cmHandleQueryParameters) {
final CmHandleQueryApiParameters cmHandleQueryApiParameters =
jsonObjectMapper.convertToValueType(cmHandleQueryParameters, CmHandleQueryApiParameters.class);
- final Set<String> cmHandleIds = networkCmProxyDataService.executeCmHandleIdSearch(cmHandleQueryApiParameters);
+ final Collection<String> cmHandleIds
+ = networkCmProxyDataService.executeCmHandleIdSearch(cmHandleQueryApiParameters);
return ResponseEntity.ok(List.copyOf(cmHandleIds));
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
index 0c27d3efb0..5d8599a1a2 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
@@ -22,8 +22,8 @@
package org.onap.cps.ncmp.rest.controller;
import io.micrometer.core.annotation.Timed;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
@@ -55,7 +55,7 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = ncmpRestInputMapper
.toCmHandleQueryServiceParameters(cmHandleQueryParameters);
- final Set<String> cmHandleIds = networkCmProxyDataService
+ final Collection<String> cmHandleIds = networkCmProxyDataService
.executeCmHandleIdSearchForInventory(cmHandleQueryServiceParameters);
return ResponseEntity.ok(List.copyOf(cmHandleIds));
}
@@ -68,7 +68,7 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
*/
@Override
public ResponseEntity<List<String>> getAllCmHandleIdsForRegisteredDmi(final String dmiPluginIdentifier) {
- final Set<String> cmHandleIds =
+ final Collection<String> cmHandleIds =
networkCmProxyDataService.getAllCmHandleIdsByDmiPluginIdentifier(dmiPluginIdentifier);
return ResponseEntity.ok(List.copyOf(cmHandleIds));
}