diff options
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 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; } |