From d0422226b45f752086c9920bdead753c644d9289 Mon Sep 17 00:00:00 2001 From: niamhcore Date: Wed, 1 Sep 2021 17:12:28 +0100 Subject: P1 - Get module name and revision persistence layer Rename ModuleReference to ExtendedModuleReference Create new ModuleReference class (moduleName and revision) Update existing sync model flow to use new module reference class Create native query to get module name and revision Issue-ID: CPS-485 Signed-off-by: niamhcore Change-Id: I0d0da7742ceef3a68e83a5dd4852091e6adf138b --- .../ncmp/api/impl/NetworkCmProxyDataServiceImpl.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'cps-ncmp-service/src/main/java/org/onap') 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 c840c0a7d4..6e1e7275bb 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 @@ -349,13 +349,13 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService protected void createAnchorAndSyncModel(final PersistenceCmHandle cmHandle) { final var modulesForCmHandle = dmiOperations.getResourceFromDmi(cmHandle.getDmiServiceName(), cmHandle.getId(), "modules"); - - final List moduleReferencesFromDmiForCmHandle = getModuleReferences(modulesForCmHandle); - - final var knownModuleReferencesInCps = cpsModuleService.getAllYangResourcesModuleReferences(); - + final List moduleReferencesFromDmiForCmHandle = + getModuleReferences(modulesForCmHandle); + final var knownModuleReferencesInCps = + cpsModuleService.getAllYangResourceModuleReferences(NF_PROXY_DATASPACE_NAME); final List existingModuleReferences = new ArrayList<>(); - for (final ModuleReference moduleReferenceFromDmiForCmHandle : moduleReferencesFromDmiForCmHandle) { + for (final ModuleReference moduleReferenceFromDmiForCmHandle : + moduleReferencesFromDmiForCmHandle) { if (knownModuleReferencesInCps.contains(moduleReferenceFromDmiForCmHandle)) { existingModuleReferences.add(moduleReferenceFromDmiForCmHandle); } @@ -396,7 +396,8 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService final JsonObject convertedObject = new Gson().fromJson(response.getBody(), JsonObject.class); final JsonArray moduleReferencesAsJson = convertedObject.getAsJsonArray("schemas"); for (final JsonElement moduleReferenceAsJson : moduleReferencesAsJson) { - final ModuleReference moduleReference = toModuleReference((JsonObject) moduleReferenceAsJson); + final ModuleReference moduleReference = + toModuleReference((JsonObject) moduleReferenceAsJson); modulesFromDmiForCmHandle.add(moduleReference); } return modulesFromDmiForCmHandle; @@ -404,8 +405,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService private ModuleReference toModuleReference(final JsonObject moduleReferenceAsJson) { final var moduleReference = new ModuleReference(); - moduleReference.setName(moduleReferenceAsJson.get("moduleName").getAsString()); - moduleReference.setNamespace(NO_NAMESPACE); + moduleReference.setModuleName(moduleReferenceAsJson.get("moduleName").getAsString()); moduleReference.setRevision(moduleReferenceAsJson.get("revision").getAsString()); return moduleReference; } -- cgit 1.2.3-korg