diff options
author | seanbeirne <sean.beirne@est.tech> | 2023-02-20 15:00:11 +0000 |
---|---|---|
committer | Priyank Maheshwari <priyank.maheshwari@est.tech> | 2023-02-22 13:46:12 +0000 |
commit | eba77598601a7e3430f9582dfe433495ded3244c (patch) | |
tree | 50cc6a9fcd4b3584e4749e4889d23c175f45addf /cps-ncmp-service/src/main/java | |
parent | 1450fd0687433278ce61ae56dfcbf42e0edddce3 (diff) |
Omit descendants when not need in ncmp inventory queries
-Seperated tests by Id and details
Issue-ID: CPS-1494
Signed-off-by: seanbeirne <sean.beirne@est.tech>
Change-Id: Ia1c2b637aa5ab2ffe3a92930d74af1dd7d0dbe92
Diffstat (limited to 'cps-ncmp-service/src/main/java')
2 files changed, 8 insertions, 5 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 a98c6008cf..ecb6e522f7 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 @@ -26,6 +26,7 @@ import static org.onap.cps.ncmp.api.impl.utils.RestQueryParametersValidator.vali import static org.onap.cps.ncmp.api.impl.utils.YangDataConverter.convertYangModelCmHandleToNcmpServiceCmHandle; import static org.onap.cps.spi.FetchDescendantsOption.FETCH_DIRECT_CHILDREN_ONLY; import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS; +import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS; import java.util.ArrayList; import java.util.Collection; @@ -49,6 +50,7 @@ import org.onap.cps.ncmp.api.inventory.InventoryPersistence; 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.FetchDescendantsOption; import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.spi.model.ConditionProperties; import org.onap.cps.spi.model.DataNode; @@ -78,7 +80,7 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm } final Map<String, NcmpServiceCmHandle> combinedQueryResult = executeInventoryQueries( - cmHandleQueryServiceParameters); + cmHandleQueryServiceParameters, INCLUDE_ALL_DESCENDANTS); return new HashSet<>(combineWithModuleNameQuery(cmHandleQueryServiceParameters, combinedQueryResult).values()); } @@ -98,7 +100,7 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm } final Map<String, NcmpServiceCmHandle> combinedQueryResult = executeInventoryQueries( - cmHandleQueryServiceParameters); + cmHandleQueryServiceParameters, OMIT_DESCENDANTS); final Collection<String> moduleNamesForQuery = getModuleNamesForQuery(cmHandleQueryServiceParameters.getCmHandleQueryParameters()); @@ -229,7 +231,8 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm } private Map<String, NcmpServiceCmHandle> executeInventoryQueries( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, + final FetchDescendantsOption fetchDescendantsOption) { final Map<String, String> cpsPath = getCpsPath(cmHandleQueryServiceParameters.getCmHandleQueryParameters()); if (!validateCpsPathConditionProperties(cpsPath)) { return Collections.emptyMap(); @@ -240,7 +243,7 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm } else { try { cpsPathQueryResult = cmHandleQueries.queryCmHandleDataNodesByCpsPath( - cpsPath.get("cpsPath"), INCLUDE_ALL_DESCENDANTS) + cpsPath.get("cpsPath"), fetchDescendantsOption) .stream().map(this::createNcmpServiceCmHandle) .collect(Collectors.toMap(NcmpServiceCmHandle::getCmHandleId, Function.identity())); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java index 0f86cb7be6..6ca716c270 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueriesImpl.java @@ -78,7 +78,7 @@ public class CmHandleQueriesImpl implements CmHandleQueries { + publicPropertyQueryPair.getKey() + "\" and @value=\"" + publicPropertyQueryPair.getValue() + "\"]"; - final Collection<DataNode> dataNodes = queryCmHandleDataNodesByCpsPath(cpsPath, INCLUDE_ALL_DESCENDANTS); + final Collection<DataNode> dataNodes = queryCmHandleDataNodesByCpsPath(cpsPath, OMIT_DESCENDANTS); if (cmHandleIdToNcmpServiceCmHandles == null) { cmHandleIdToNcmpServiceCmHandles = collectDataNodesToNcmpServiceCmHandles(dataNodes); } else { |