diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-02 22:54:57 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-02 22:54:57 -0400 |
commit | 86f04e1d55b54a1a23bb274d211c6fca85980fef (patch) | |
tree | e8fb0a8c1d5e64761068df56faa8a8e509fa2f48 /bpmn/so-bpmn-tasks/src/main/java/org/onap | |
parent | d59fc0ad5db7b7cacf5996f86db34f41090061fa (diff) |
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) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap')
2 files changed, 17 insertions, 17 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index aeffb0ecab..867be2ec95 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -64,7 +64,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -792,8 +792,8 @@ public class WorkflowAction { vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid(); } if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){ - List<VnfVfmoduleCvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID); - for(VnfVfmoduleCvnfcConfigurationCustomization config : configs){ + List<CvnfcConfigurationCustomization> configs = traverseCatalogDbForConfiguration(validate.getModelInfo().getModelVersionId(),vnfCustomizationUUID,vfModuleCustomizationUUID); + for(CvnfcConfigurationCustomization config : configs){ Resource configResource = new Resource(WorkflowType.CONFIGURATION,config.getConfigurationResource().getModelUUID(),false); resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId()); resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId()); @@ -829,18 +829,18 @@ public class WorkflowAction { return foundRelated; } - protected List<VnfVfmoduleCvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) { - List<VnfVfmoduleCvnfcConfigurationCustomization> configurations = new ArrayList<>(); + protected List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID, String vnfCustomizationUUID, String vfModuleCustomizationUUID) { + List<CvnfcConfigurationCustomization> configurations = new ArrayList<>(); try{ - List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID); + List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID,vnfCustomizationUUID, vfModuleCustomizationUUID); for(CvnfcCustomization cvnfc : cvnfcCustomizations){ - for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){ + for(CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()){ if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){ configurations.add(customization); } } } - logger.debug("found {} configuration(s)" , configurations.size() ); + logger.debug("found {} fabric configuration(s)" , configurations.size() ); return configurations; } catch (Exception ex){ logger.error("Error in finding configurations", ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 242f125bde..a0b48fda37 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -36,13 +35,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; -import org.onap.so.db.catalog.beans.CvnfcCustomization; -import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; @@ -367,16 +361,21 @@ public class WorkflowActionBBTasks { protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) { try { + String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId(); String vnfId = ebb.getWorkflowResourceIds().getVnfId(); String vfModuleId = ebb.getResourceId(); ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId); + String serviceModelUUID = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId(); String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(); String vfModuleCustomizationUUID = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId(); List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC); + logger.debug("Vnfc Size: {}", vnfcs.size()); for(Vnfc vnfc : vnfcs) { String modelCustomizationId = vnfc.getModelCustomizationId(); - VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = - catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId); + logger.debug("Processing Vnfc: {}", modelCustomizationId); + CvnfcConfigurationCustomization fabricConfig = + catalogDbClient.getCvnfcCustomization(serviceModelUUID,vnfCustomizationUUID, + vfModuleCustomizationUUID, modelCustomizationId); if(fabricConfig != null && fabricConfig.getConfigurationResource() != null && fabricConfig.getConfigurationResource().getToscaNodeType() != null && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { @@ -390,6 +389,7 @@ public class WorkflowActionBBTasks { ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); flowsToExecute.add(assignConfigBB); flowsToExecute.add(activateConfigBB); + flowsToExecute.stream().forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", executeBB.getBuildingBlock().getBpmnFlowName())); execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable("completed", false); } else { |