diff options
author | DylanB95EST <dylan.byrne@est.tech> | 2021-08-24 16:56:40 +0100 |
---|---|---|
committer | Dylan Byrne <dylan.byrne@est.tech> | 2021-08-25 15:00:17 +0000 |
commit | e999b02056c3b4f4a7d891d105d75435d101e6ad (patch) | |
tree | ee31f553335803f0af85e661369fe0f274cd734d /cps-ncmp-service/src/main/java/org | |
parent | 5aba6667d330835fa3661ffba0d88f88029da446 (diff) |
Remove CmHandle in DMI-Registry
Remove CM Handles within DMI-Registry as part of DMI-Registration story.
Issue-ID: CPS-444
Change-Id: I91bb5e346354b2723fafb565c25d5728731aa09e
Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main/java/org')
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 1ea95d3e65..ca5fa8e086 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 @@ -42,6 +42,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; @@ -131,6 +132,9 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService if (dmiPluginRegistration.getUpdatedCmHandles() != null) { parseAndUpdateCmHandlesInDmiRegistration(dmiPluginRegistration); } + if (dmiPluginRegistration.getRemovedCmHandles() != null) { + parseAndRemoveCmHandlesInDmiRegistration(dmiPluginRegistration); + } } private void parseAndCreateCmHandlesInDmiRegistration(final DmiPluginRegistration dmiPluginRegistration) { @@ -173,6 +177,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; } |