diff options
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java index a8fc6d705..b67ae0c19 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java @@ -49,7 +49,6 @@ import org.onap.cps.ncmp.api.inventory.enums.PropertyType; import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters; import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; import org.onap.cps.spi.exceptions.DataValidationException; -import org.onap.cps.spi.model.Anchor; import org.onap.cps.spi.model.ConditionProperties; import org.onap.cps.spi.model.DataNode; import org.springframework.stereotype.Service; @@ -105,7 +104,8 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm if (moduleNamesForQuery.isEmpty()) { return combinedQueryResult.keySet(); } - final Set<String> moduleNameQueryResult = getNamesOfAnchorsWithGivenModules(moduleNamesForQuery); + final Set<String> moduleNameQueryResult = + new HashSet<>(inventoryPersistence.getCmHandleIdsWithGivenModules(moduleNamesForQuery)); if (combinedQueryResult == NO_QUERY_TO_EXECUTE) { return moduleNameQueryResult; @@ -209,7 +209,8 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm if (moduleNamesForQuery.isEmpty()) { return previousQueryResult; } - final Collection<String> cmHandleIdsByModuleName = getNamesOfAnchorsWithGivenModules(moduleNamesForQuery); + final Collection<String> cmHandleIdsByModuleName = + inventoryPersistence.getCmHandleIdsWithGivenModules(moduleNamesForQuery); if (cmHandleIdsByModuleName.isEmpty()) { return Collections.emptyMap(); } @@ -260,11 +261,6 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm return cmHandleQueries.combineCmHandleQueries(cpsPathQueryResult, propertiesQueryResult); } - private Set<String> getNamesOfAnchorsWithGivenModules(final Collection<String> moduleNamesForQuery) { - final Collection<Anchor> anchors = inventoryPersistence.queryAnchors(moduleNamesForQuery); - return anchors.parallelStream().map(Anchor::getName).collect(Collectors.toSet()); - } - private Collection<String> getModuleNamesForQuery(final List<ConditionProperties> conditionProperties) { final List<String> result = new ArrayList<>(); getConditions(conditionProperties, CmHandleQueryConditions.HAS_ALL_MODULES.getConditionName()) |