From 86f04e1d55b54a1a23bb274d211c6fca85980fef Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Tue, 2 Apr 2019 22:54:57 -0400 Subject: fix catalogdb cvfnc customization Hibernate entities were all wrong and needed a complete rewrite. The scope kept growing and ended up touching a lot more of the code than originally planned. These changes make the db interactions much easier and more straightforward from java. The flyway script order had to change to make this migration possible. Change-Id: I6ce363a385661300eddb11923ac6a80538edaddc Issue-ID: SO-1710 Signed-off-by: Benjamin, Max (mb388a) --- .../servicedecomposition/tasks/BBInputSetup.java | 29 +++++++--------------- .../tasks/BBInputSetupMapperLayer.java | 20 +++++++-------- .../tasks/BBInputSetupUtils.java | 12 +++------ 3 files changed, 22 insertions(+), 39 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main/java') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 76b24caf09..f5b77781a4 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -72,13 +72,13 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.serviceinstancebeans.CloudConfiguration; @@ -413,15 +413,15 @@ public class BBInputSetup implements JavaDelegate { protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) { ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = - findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(), + CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = + findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization); if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) { configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization , vnfVfmoduleCvnfcConfigurationCustomization)); } else { logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID()); - vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVnfResourceCustomizationUUID(), + vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(),configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID()); if (vnfVfmoduleCvnfcConfigurationCustomization != null){ configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization)); @@ -429,18 +429,9 @@ public class BBInputSetup implements JavaDelegate { } } - protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID, + protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, String vfModuleCustomizationUUID, String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) { - if(configurationResourceCustomization != null && configurationResourceCustomization.getConfigurationResource() != null) - for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization : - configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) { - if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID) - && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID) - && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) { - return vnfVfmoduleCvnfcConfigurationCustomization; - } - } - return null; + return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID); } protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { @@ -452,11 +443,9 @@ public class BBInputSetup implements JavaDelegate { return null; } - protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vnfResourceCustomizationUUID, + protected CvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String serviceModelUUID, String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) { - return bbInputSetupUtils.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId(vnfResourceCustomizationUUID, - vfModuleCustomizationUUID, cvnfcCustomizationUUID); - + return bbInputSetupUtils.getCvnfcConfigurationCustomization(serviceModelUUID, vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID); } protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, @@ -730,7 +719,7 @@ public class BBInputSetup implements JavaDelegate { .getVnfcInstanceGroupCustomizations(); for (VnfcInstanceGroupCustomization vnfcInstanceGroupCust : vnfcInstanceGroups) { InstanceGroup instanceGroup = this.createInstanceGroup(); - org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getModelUUID()); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = bbInputSetupUtils.getCatalogInstanceGroup(vnfcInstanceGroupCust.getInstanceGroup().getModelUUID()); instanceGroup.setModelInfoInstanceGroup(this.mapperLayer .mapCatalogInstanceGroupToInstanceGroup(null, catalogInstanceGroup)); instanceGroup.getModelInfoInstanceGroup().setFunction(vnfcInstanceGroupCust.getFunction()); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 50a9c4e8b1..d8c80ced75 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -74,6 +74,7 @@ import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.InstanceGroupType; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; @@ -81,7 +82,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; import org.slf4j.Logger; @@ -489,24 +489,24 @@ public class BBInputSetupMapperLayer { protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( ConfigurationResourceCustomization configurationResourceCustomization, - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) { + CvnfcConfigurationCustomization cvnfcConfigurationCustomization) { ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); - modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName()); + modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName()); return modelInfoConfiguration; } protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( - VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) { + CvnfcConfigurationCustomization cvnfcConfigurationCustomization) { ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); - modelInfoConfiguration.setModelVersionId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelUUID()); - modelInfoConfiguration.setModelCustomizationId(vnfVfmoduleCvnfcConfigurationCustomization.getModelCustomizationUUID()); - modelInfoConfiguration.setModelInvariantId(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID()); - modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName()); - modelInfoConfiguration.setConfigurationType(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationType()); - modelInfoConfiguration.setConfigurationRole(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationRole()); + modelInfoConfiguration.setModelVersionId(cvnfcConfigurationCustomization.getConfigurationResource().getModelUUID()); + modelInfoConfiguration.setModelCustomizationId(cvnfcConfigurationCustomization.getModelCustomizationUUID()); + modelInfoConfiguration.setModelInvariantId(cvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID()); + modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName()); + modelInfoConfiguration.setConfigurationType(cvnfcConfigurationCustomization.getConfigurationType()); + modelInfoConfiguration.setConfigurationRole(cvnfcConfigurationCustomization.getConfigurationRole()); return modelInfoConfiguration; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 88ed5d37d9..9a08d1872d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -53,10 +53,10 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -145,10 +145,9 @@ public class BBInputSetupUtils { return catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelCustomizationUUID); } - public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String vnfCustomizationUuid, + public CvnfcConfigurationCustomization getCvnfcConfigurationCustomization(String serviceModelUUID, String vnfCustomizationUuid, String vfModuleCustomizationUuid, String cvnfcCustomizationUuid){ - return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUuid, - vfModuleCustomizationUuid, cvnfcCustomizationUuid); + return catalogDbClient.getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid,vfModuleCustomizationUuid, cvnfcCustomizationUuid); } public List getVnfcInstanceGroups(String modelCustomizationUUID) { @@ -451,9 +450,4 @@ public class BBInputSetupUtils { return Optional.of(volumeGroup); } } - - public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationIdnAndVfModuleCustomizationIdAndCvnfcCustomizationId( - String vnfResourceCustomizationUUID, String vfModuleCustomizationUUID, String cvnfcCustomizationUUID) { - return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfResourceCustomizationUUID, vfModuleCustomizationUUID, cvnfcCustomizationUUID); - } } -- cgit 1.2.3-korg