diff options
author | niamhcore <niamh.core@est.tech> | 2021-12-08 14:19:02 +0000 |
---|---|---|
committer | niamhcore <niamh.core@est.tech> | 2021-12-08 15:32:10 +0000 |
commit | 65bc4fdc0264d75a9fc9b468a1ca329cb0b8c260 (patch) | |
tree | 9dd3480075348831214ccdb59c3c3a067e88785b /cps-ncmp-service/src/main/java/org/onap | |
parent | 8c9b4a24b4841154a2d08f506e2f7beca4f6fc31 (diff) |
Delete anchor and schema set when a registration is removed
Issue-ID: CPS-783
Signed-off-by: niamhcore <niamh.core@est.tech>
Change-Id: I9644949e00c4de900b2609c1e70744ae5a243582
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap')
-rwxr-xr-x | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java | 7 |
1 files changed, 5 insertions, 2 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 363dbc2112..faa2efe3a9 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 @@ -24,6 +24,7 @@ package org.onap.cps.ncmp.api.impl; import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum; +import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -289,13 +290,15 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } protected void syncModulesAndCreateAnchor(final PersistenceCmHandle persistenceCmHandle) { - fetchAndSyncModules(persistenceCmHandle); + syncAndCreateSchemaSet(persistenceCmHandle); createAnchor(persistenceCmHandle); } private void parseAndRemoveCmHandlesInDmiRegistration(final DmiPluginRegistration dmiPluginRegistration) { for (final String cmHandle : dmiPluginRegistration.getRemovedCmHandles()) { try { + cpsModuleService.deleteSchemaSet(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, cmHandle, + CASCADE_DELETE_ALLOWED); cpsDataService.deleteListOrListElement(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, "/dmi-registry/cm-handles[@id='" + cmHandle + "']", NO_TIMESTAMP); } catch (final DataNodeNotFoundException e) { @@ -304,7 +307,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } } - private void fetchAndSyncModules(final PersistenceCmHandle persistenceCmHandle) { + private void syncAndCreateSchemaSet(final PersistenceCmHandle persistenceCmHandle) { final List<ModuleReference> moduleReferencesFromCmHandle = toModuleReferences(dmiModelOperations.getModuleReferences(persistenceCmHandle)); |