diff options
Diffstat (limited to 'cps-ncmp-service/src/main/java')
-rwxr-xr-x | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index 5aad404e61..8b80a0341a 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -325,8 +325,10 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService final List<String> tobeRemovedCmHandles) { final List<CmHandleRegistrationResponse> cmHandleRegistrationResponses = new ArrayList<>(tobeRemovedCmHandles.size()); - - setState(tobeRemovedCmHandles, CmHandleState.DELETING); + final List<YangModelCmHandle> yangModelCmHandles = + tobeRemovedCmHandles.stream().map(inventoryPersistence::getYangModelCmHandle) + .collect(Collectors.toList()); + updateCmHandleStateBatch(yangModelCmHandles, CmHandleState.DELETING); for (final String cmHandleId : tobeRemovedCmHandles) { try { @@ -350,18 +352,15 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } } - setState(tobeRemovedCmHandles, CmHandleState.DELETED); - + updateCmHandleStateBatch(yangModelCmHandles, CmHandleState.DELETED); return cmHandleRegistrationResponses; } - private void setState(final List<String> tobeRemovedCmHandles, final CmHandleState cmHandleState) { + private void updateCmHandleStateBatch(final List<YangModelCmHandle> yangModelCmHandles, + final CmHandleState cmHandleState) { final Map<YangModelCmHandle, CmHandleState> cmHandleIdsToBeRemoved = new HashMap<>(); - for (final String cmHandleId : tobeRemovedCmHandles) { - cmHandleIdsToBeRemoved.put( - inventoryPersistence.getYangModelCmHandle(cmHandleId), - cmHandleState); - } + yangModelCmHandles.stream().forEach(yangModelCmHandle -> + cmHandleIdsToBeRemoved.put(yangModelCmHandle, cmHandleState)); lcmEventsCmHandleStateHandler.updateCmHandleStateBatch(cmHandleIdsToBeRemoved); } |