From c37dee4816f51f750a9c92946dc9d4a558f3b812 Mon Sep 17 00:00:00 2001 From: seanbeirne Date: Tue, 5 Nov 2024 10:21:30 +0000 Subject: Support alternate Id interface for ncmp inventory /ch/cmhandles endpoint Issue-ID: CPS-2481 Change-Id: I8a200495be1afb9a4f256127f886bed78c77f653 Signed-off-by: seanbeirne --- .../inventory/NetworkCmProxyInventoryFacade.java | 21 ++++++++------ .../impl/data/utils/DmiDataOperationsHelper.java | 10 +++---- .../ncmp/impl/inventory/CmHandleQueryService.java | 16 ++++++----- .../impl/inventory/CmHandleQueryServiceImpl.java | 33 +++++++++++++--------- .../ncmp/impl/inventory/InventoryPersistence.java | 2 +- .../impl/inventory/InventoryPersistenceImpl.java | 4 +-- .../ParameterizedCmHandleQueryService.java | 4 +-- .../ParameterizedCmHandleQueryServiceImpl.java | 32 +++++++++++---------- .../trustlevel/DmiPluginTrustLevelWatchDog.java | 2 +- 9 files changed, 68 insertions(+), 56 deletions(-) (limited to 'cps-ncmp-service/src/main') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java index e9e5f5499f..a8996874ff 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java @@ -75,13 +75,16 @@ public class NetworkCmProxyInventoryFacade { } /** - * Get all cm handle IDs by DMI plugin identifier. + * Get all cm handle references by DMI plugin identifier. * * @param dmiPluginIdentifier DMI plugin identifier - * @return collection of cm handle IDs + * @param outputAlternateId Boolean for cm handle reference type either + * cm handle id (false) or alternate id (true) + * @return collection of cm handle references */ - public Collection getAllCmHandleIdsByDmiPluginIdentifier(final String dmiPluginIdentifier) { - return cmHandleQueryService.getCmHandleIdsByDmiPluginIdentifier(dmiPluginIdentifier); + public Collection getAllCmHandleReferencesByDmiPluginIdentifier(final String dmiPluginIdentifier, + final boolean outputAlternateId) { + return cmHandleQueryService.getCmHandleReferencesByDmiPluginIdentifier(dmiPluginIdentifier, outputAlternateId); } /** @@ -90,10 +93,10 @@ public class NetworkCmProxyInventoryFacade { * @param cmHandleQueryServiceParameters cm handle query parameters * @param outputAlternateId Boolean for cm handle reference type either * cm handle id (false) or alternate id (true) - * @return collection of cm handle IDs + * @return collection of cm handle references */ public Collection executeParameterizedCmHandleIdSearch( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final Boolean outputAlternateId) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) { validateCmHandleQueryParameters(cmHandleQueryServiceParameters, InventoryQueryConditions.ALL_CONDITION_NAMES); return parameterizedCmHandleQueryService.queryCmHandleIdsForInventory(cmHandleQueryServiceParameters, @@ -159,11 +162,11 @@ public class NetworkCmProxyInventoryFacade { * Retrieve cm handle ids for the given query parameters. * * @param cmHandleQueryApiParameters cm handle query parameters - * @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) + * @param outputAlternateId Boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) * @return cm handle ids */ public Collection executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = jsonObjectMapper.convertToValueType( cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class); validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES); @@ -224,4 +227,4 @@ public class NetworkCmProxyInventoryFacade { .getEffectiveTrustLevel(ncmpServiceCmHandle.getCmHandleId())); } -} +} \ No newline at end of file diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java index f1dc9af09d..a0d89644e4 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/data/utils/DmiDataOperationsHelper.java @@ -71,8 +71,8 @@ public class DmiDataOperationsHelper { final Map> dmiDataOperationsOutPerDmiServiceName = new HashMap<>(); final MultiValueMap>> cmHandleReferencesPerResponseCodesPerOperation = new LinkedMultiValueMap<>(); - final Map nonReadyCmHandleReferencesLookup = - filterAndGetNonReadyCmHandleReferences(yangModelCmHandles); + final Map nonReadyAlternateIdPerCmHandleId = + filterAndGetNonReadyAlternateIdPerCmHandleId(yangModelCmHandles); final Map>> dmiPropertiesPerCmHandleIdPerServiceName = DmiServiceNameOrganizer.getDmiPropertiesPerCmHandleIdPerServiceName(yangModelCmHandles); @@ -87,8 +87,8 @@ public class DmiDataOperationsHelper { final List nonExistingCmHandleReferences = new ArrayList<>(); final List nonReadyCmHandleReferences = new ArrayList<>(); for (final String cmHandleReference : dataOperationDefinitionIn.getCmHandleReferences()) { - if (nonReadyCmHandleReferencesLookup.containsKey(cmHandleReference) - || nonReadyCmHandleReferencesLookup.containsValue(cmHandleReference)) { + if (nonReadyAlternateIdPerCmHandleId.containsKey(cmHandleReference) + || nonReadyAlternateIdPerCmHandleId.containsValue(cmHandleReference)) { nonReadyCmHandleReferences.add(cmHandleReference); } else { final String cmHandleId = getCmHandleId(cmHandleReference, yangModelCmHandles); @@ -184,7 +184,7 @@ public class DmiDataOperationsHelper { return dmiBatchOperationsOut.get(dmiBatchOperationsOut.size() - 1); } - private static Map filterAndGetNonReadyCmHandleReferences( + private static Map filterAndGetNonReadyAlternateIdPerCmHandleId( final Collection yangModelCmHandles) { final Map cmHandleReferenceMap = new HashMap<>(yangModelCmHandles.size()); for (final YangModelCmHandle yangModelCmHandle: yangModelCmHandles) { diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java index 86e9c934ce..74c04928ed 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryService.java @@ -36,7 +36,7 @@ public interface CmHandleQueryService { * @return Ids of Cm Handles which have these private properties */ Collection queryCmHandleAdditionalProperties(Map additionalPropertyQueryPairs, - Boolean outputAlternateId); + boolean outputAlternateId); /** * Query Cm Handles based on public properties. @@ -46,7 +46,7 @@ public interface CmHandleQueryService { * @return CmHandles which have these public properties */ Collection queryCmHandlePublicProperties(Map publicPropertyQueryPairs, - Boolean outputAlternateId); + boolean outputAlternateId); /** * Query Cm Handles based on Trust Level. @@ -56,7 +56,7 @@ public interface CmHandleQueryService { * @return Ids of Cm Handles which have desired trust level */ Collection queryCmHandlesByTrustLevel(Map trustLevelPropertyQueryPairs, - Boolean outputAlternateId); + boolean outputAlternateId); /** * Method which returns cm handles by the cm handles state. @@ -100,19 +100,21 @@ public interface CmHandleQueryService { Collection queryCmHandlesByOperationalSyncState(DataStoreSyncState dataStoreSyncState); /** - * Get all cm handles ids by DMI plugin identifier. + * Get collection of all cm handles references by DMI plugin identifier and alternate id output option. * * @param dmiPluginIdentifier DMI plugin identifier + * @param outputAlternateId Boolean for cm handle reference type either cmHandleId (false) or AlternateId (true) * @return collection of cm handle ids */ - Collection getCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier); + Collection getCmHandleReferencesByDmiPluginIdentifier(String dmiPluginIdentifier, + boolean outputAlternateId); /** - * Get map of cmHandle ids and alternate ids by DMI plugin identifier. + * Get map of cmHandle references by DMI plugin identifier. * * @param dmiPluginIdentifier DMI plugin identifier * @return map of cmHandle references key:CmHandleId Value:AlternateId */ - Map getCmHandleReferencesByDmiPluginIdentifier(String dmiPluginIdentifier); + Map getCmHandleReferencesMapByDmiPluginIdentifier(String dmiPluginIdentifier); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java index 4249b452c3..1490d69881 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java @@ -68,19 +68,19 @@ public class CmHandleQueryServiceImpl implements CmHandleQueryService { @Override public Collection queryCmHandleAdditionalProperties(final Map privatePropertyQueryPairs, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { return queryCmHandleAnyProperties(privatePropertyQueryPairs, PropertyType.ADDITIONAL, outputAlternateId); } @Override public Collection queryCmHandlePublicProperties(final Map publicPropertyQueryPairs, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { return queryCmHandleAnyProperties(publicPropertyQueryPairs, PropertyType.PUBLIC, outputAlternateId); } @Override public Collection queryCmHandlesByTrustLevel(final Map trustLevelPropertyQueryPairs, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { final String trustLevelProperty = trustLevelPropertyQueryPairs.values().iterator().next(); final TrustLevel targetTrustLevel = TrustLevel.valueOf(trustLevelProperty); return getCmHandleReferencesByTrustLevel(targetTrustLevel, outputAlternateId); @@ -122,20 +122,25 @@ public class CmHandleQueryServiceImpl implements CmHandleQueryService { } @Override - public Collection getCmHandleIdsByDmiPluginIdentifier(final String dmiPluginIdentifier) { - final Collection cmHandleIds = new HashSet<>(); + public Collection getCmHandleReferencesByDmiPluginIdentifier(final String dmiPluginIdentifier, + final boolean outputAlternateId) { + final Collection cmHandleReferences = new HashSet<>(); for (final ModelledDmiServiceLeaves modelledDmiServiceLeaf : ModelledDmiServiceLeaves.values()) { for (final DataNode cmHandleAsDataNode: getCmHandlesByDmiPluginIdentifierAndDmiProperty( dmiPluginIdentifier, modelledDmiServiceLeaf.getLeafName())) { - cmHandleIds.add(cmHandleAsDataNode.getLeaves().get("id").toString()); + if (outputAlternateId) { + cmHandleReferences.add(cmHandleAsDataNode.getLeaves().get(ALTERNATE_ID).toString()); + } else { + cmHandleReferences.add(cmHandleAsDataNode.getLeaves().get("id").toString()); + } } } - return cmHandleIds; + return cmHandleReferences; } @Override - public Map getCmHandleReferencesByDmiPluginIdentifier(final String dmiPluginIdentifier) { + public Map getCmHandleReferencesMapByDmiPluginIdentifier(final String dmiPluginIdentifier) { final Map cmHandleReferencesMap = new HashMap<>(); for (final ModelledDmiServiceLeaves modelledDmiServiceLeaf : ModelledDmiServiceLeaves.values()) { for (final DataNode cmHandleAsDataNode: getCmHandlesByDmiPluginIdentifierAndDmiProperty( @@ -149,21 +154,21 @@ public class CmHandleQueryServiceImpl implements CmHandleQueryService { } private Collection getCmHandleReferencesByTrustLevel(final TrustLevel targetTrustLevel, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { final Collection selectedCmHandleReferences = new HashSet<>(); for (final Map.Entry mapEntry : trustLevelPerDmiPlugin.entrySet()) { final String dmiPluginIdentifier = mapEntry.getKey(); final TrustLevel dmiTrustLevel = mapEntry.getValue(); final Map candidateCmHandleReferences = - getCmHandleReferencesByDmiPluginIdentifier(dmiPluginIdentifier); + getCmHandleReferencesMapByDmiPluginIdentifier(dmiPluginIdentifier); for (final Map.Entry candidateCmHandleReference : candidateCmHandleReferences.entrySet()) { final TrustLevel candidateCmHandleTrustLevel = trustLevelPerCmHandle.get(candidateCmHandleReference.getKey()); final TrustLevel effectiveTrustlevel = candidateCmHandleTrustLevel.getEffectiveTrustLevel(dmiTrustLevel); if (targetTrustLevel.equals(effectiveTrustlevel)) { - if (Boolean.TRUE.equals(outputAlternateId)) { + if (outputAlternateId) { selectedCmHandleReferences.add(candidateCmHandleReference.getValue()); } else { selectedCmHandleReferences.add(candidateCmHandleReference.getKey()); @@ -175,8 +180,8 @@ public class CmHandleQueryServiceImpl implements CmHandleQueryService { } private Collection collectCmHandleReferencesFromDataNodes(final Collection dataNodes, - final Boolean outputAlternateId) { - if (Boolean.TRUE.equals(outputAlternateId)) { + final boolean outputAlternateId) { + if (outputAlternateId) { return dataNodes.stream().map(dataNode -> (String) dataNode.getLeaves().get(ALTERNATE_ID)).collect(Collectors.toSet()); } else { @@ -187,7 +192,7 @@ public class CmHandleQueryServiceImpl implements CmHandleQueryService { private Collection queryCmHandleAnyProperties( final Map propertyQueryPairs, - final PropertyType propertyType, final Boolean outputAlternateId) { + final PropertyType propertyType, final boolean outputAlternateId) { if (propertyQueryPairs.isEmpty()) { return Collections.emptySet(); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java index de8e8e80a7..61d7df923e 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistence.java @@ -162,7 +162,7 @@ public interface InventoryPersistence extends NcmpPersistence { * @return Collection of CM handle Ids */ Collection getCmHandleReferencesWithGivenModules(Collection moduleNamesForQuery, - Boolean outputAlternateIds); + boolean outputAlternateIds); /** * Check database if cm handle id exists if not return false. diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java index d73fae9fbc..c4765ff53d 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java @@ -218,8 +218,8 @@ public class InventoryPersistenceImpl extends NcmpPersistenceImpl implements Inv @Override public Collection getCmHandleReferencesWithGivenModules(final Collection moduleNamesForQuery, - final Boolean outputAlternateIds) { - if (Boolean.TRUE.equals(outputAlternateIds)) { + final boolean outputAlternateIds) { + if (outputAlternateIds) { final Collection cmHandleIds = cpsAnchorService.queryAnchorNames(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, moduleNamesForQuery); return getAlternateIdsFromDataNodes(getCmHandleDataNodes(cmHandleIds)); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java index 8301579b42..3db4920d3e 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java @@ -38,7 +38,7 @@ public interface ParameterizedCmHandleQueryService { * @return collection of cm handle ids or alternate ids */ Collection queryCmHandleReferenceIds(CmHandleQueryServiceParameters cmHandleQueryServiceParameters, - Boolean outputAlternateId); + boolean outputAlternateId); /** * Query and return cm handle ids or alternate ids that match the given query parameters. @@ -54,7 +54,7 @@ public interface ParameterizedCmHandleQueryService { * @return collection of cm handle ids */ Collection queryCmHandleIdsForInventory(CmHandleQueryServiceParameters cmHandleQueryServiceParameters, - Boolean outputAlternateId); + boolean outputAlternateId); /** * Query and return cm handle objects that match the given query parameters. diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java index bacbbe0c95..c0d4b08f3c 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java @@ -63,7 +63,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan @Override public Collection queryCmHandleReferenceIds( final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { return executeQueries(cmHandleQueryServiceParameters, outputAlternateId, this::executeCpsPathQuery, this::queryCmHandlesByPublicProperties, @@ -74,7 +74,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan @Override public Collection queryCmHandleIdsForInventory( final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { return executeQueries(cmHandleQueryServiceParameters, outputAlternateId, this::executeCpsPathQuery, this::queryCmHandlesByPublicProperties, @@ -102,7 +102,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan } private Collection queryCmHandlesByDmiPlugin( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final Boolean outputAlternateId) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) { final Map dmiPropertyQueryPairs = getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(), InventoryQueryConditions.CM_HANDLE_WITH_DMI_PLUGIN.getName()); @@ -113,15 +113,17 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan final String dmiPluginIdentifierValue = dmiPropertyQueryPairs .get(PropertyType.DMI_PLUGIN.getYangContainerName()); - if (Boolean.TRUE.equals(outputAlternateId)) { - return cmHandleQueryService.getCmHandleReferencesByDmiPluginIdentifier(dmiPluginIdentifierValue).values(); + if (outputAlternateId) { + return + cmHandleQueryService.getCmHandleReferencesMapByDmiPluginIdentifier(dmiPluginIdentifierValue).values(); } else { - return cmHandleQueryService.getCmHandleIdsByDmiPluginIdentifier(dmiPluginIdentifierValue); + return cmHandleQueryService.getCmHandleReferencesByDmiPluginIdentifier(dmiPluginIdentifierValue, + outputAlternateId); } } private Collection queryCmHandlesByPrivateProperties( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final Boolean outputAlternateId) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) { final Map privatePropertyQueryPairs = getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(), @@ -134,7 +136,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan } private Collection queryCmHandlesByPublicProperties( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final Boolean outputAlternateId) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) { final Map publicPropertyQueryPairs = getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(), @@ -148,7 +150,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan private Collection queryCmHandlesByTrustLevel(final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, - final Boolean outputAlternateId) { + final boolean outputAlternateId) { final Map trustLevelPropertyQueryPairs = getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(), @@ -161,7 +163,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan } private Collection executeModuleNameQuery( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final Boolean outputAlternateId) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) { final Collection moduleNamesForQuery = getModuleNamesForQuery(cmHandleQueryServiceParameters.getCmHandleQueryParameters()); if (moduleNamesForQuery.isEmpty()) { @@ -171,7 +173,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan } private Collection executeCpsPathQuery( - final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final Boolean outputAlternateId) { + final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) { final Map cpsPathCondition = getCpsPathCondition(cmHandleQueryServiceParameters.getCmHandleQueryParameters()); if (!validateCpsPathConditionProperties(cpsPathCondition)) { @@ -225,7 +227,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan return Collections.emptyList(); } - private Collection getAllCmHandleReferences(final Boolean outputAlternateId) { + private Collection getAllCmHandleReferences(final boolean outputAlternateId) { final DataNode dataNode = inventoryPersistence.getDataNode(NCMP_DMI_REGISTRY_PARENT, DIRECT_CHILDREN_ONLY) .iterator().next(); return collectCmHandleReferencesFromDataNodes(dataNode.getChildDataNodes(), outputAlternateId); @@ -248,7 +250,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan } private Collection executeQueries(final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, - final Boolean outputAlternateId, + final boolean outputAlternateId, final BiFunction>... queryFunctions) { if (cmHandleQueryServiceParameters.getCmHandleQueryParameters().isEmpty()) { @@ -286,8 +288,8 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan } private Collection collectCmHandleReferencesFromDataNodes(final Collection dataNodes, - final Boolean outputAlternateId) { - if (Boolean.TRUE.equals(outputAlternateId)) { + final boolean outputAlternateId) { + if (outputAlternateId) { return dataNodes.stream().map(dataNode -> (String) dataNode.getLeaves().get("alternate-id")).collect(Collectors.toSet()); } else { diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDog.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDog.java index 7581c4af7a..aca485f53d 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDog.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/DmiPluginTrustLevelWatchDog.java @@ -66,7 +66,7 @@ public class DmiPluginTrustLevelWatchDog { log.debug("The Dmi Plugin: {} has already the same trust level: {}", dmiServiceName, newDmiTrustLevel); } else { final Collection cmHandleIds = - cmHandleQueryService.getCmHandleIdsByDmiPluginIdentifier(dmiServiceName); + cmHandleQueryService.getCmHandleReferencesByDmiPluginIdentifier(dmiServiceName, false); trustLevelManager.updateDmi(dmiServiceName, cmHandleIds, newDmiTrustLevel); } }); -- cgit 1.2.3-korg