diff options
author | Niamh Core <niamh.core@est.tech> | 2021-08-25 15:19:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-08-25 15:19:17 +0000 |
commit | 0b0a89eec95e2cb2671bdd393e94fdaa89b9cc66 (patch) | |
tree | 800bfe4334c028b4cdaba7a2a3e4b348aea97eec /cps-ncmp-service/src/main | |
parent | 7b433410a35049130b5ec27239c3b00783fe1ff8 (diff) | |
parent | e999b02056c3b4f4a7d891d105d75435d101e6ad (diff) |
Merge "Remove CmHandle in DMI-Registry"
Diffstat (limited to 'cps-ncmp-service/src/main')
2 files changed, 16 insertions, 1 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 a8c92d11f5..235030a84c 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 @@ -43,6 +43,7 @@ import org.onap.cps.ncmp.api.models.GenericRequestBody; import org.onap.cps.ncmp.api.models.PersistenceCmHandle; import org.onap.cps.ncmp.api.models.PersistenceCmHandlesList; import org.onap.cps.spi.FetchDescendantsOption; +import org.onap.cps.spi.exceptions.DataNodeNotFoundException; import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.spi.model.DataNode; import org.springframework.http.HttpStatus; @@ -133,6 +134,9 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService if (dmiPluginRegistration.getUpdatedCmHandles() != null) { parseAndUpdateCmHandlesInDmiRegistration(dmiPluginRegistration); } + if (dmiPluginRegistration.getRemovedCmHandles() != null) { + parseAndRemoveCmHandlesInDmiRegistration(dmiPluginRegistration); + } } private void parseAndCreateCmHandlesInDmiRegistration(final DmiPluginRegistration dmiPluginRegistration) { @@ -175,6 +179,17 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } } + private void parseAndRemoveCmHandlesInDmiRegistration(final DmiPluginRegistration dmiPluginRegistration) { + for (final String cmHandle: dmiPluginRegistration.getRemovedCmHandles()) { + try { + cpsDataService.deleteListNodeData(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, + "/dmi-registry/cm-handles[@id='" + cmHandle + "']"); + } catch (final DataNodeNotFoundException e) { + log.warn("Datanode {} not deleted message {}", cmHandle, e.getMessage()); + } + } + } + @Override public Object getResourceDataOperationalForCmHandle(final @NotNull String cmHandle, final @NotNull String resourceIdentifier, diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java index fcf9e92d03..f5a0d79548 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java @@ -41,6 +41,6 @@ public class DmiPluginRegistration { private List<CmHandle> updatedCmHandles; - private List<CmHandle> deletedCmHandles; + private List<String> removedCmHandles; } |