From 3b6caf9cc8e1341ea000cb55ae277f622c816dda Mon Sep 17 00:00:00 2001 From: zm330 Date: Tue, 24 Mar 2020 11:16:56 +0800 Subject: Update Asdc DB table Issue-ID: SO-2758 Signed-off-by: zm330 Change-Id: Ic916e55effe0e3688b8d014fb70ea0e2ad23c16a --- .../installer/heat/ToscaResourceInstaller.java | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'asdc-controller/src/main/java/org/onap') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 423c1a7ed6..4bc3f884f8 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -215,9 +215,6 @@ public class ToscaResourceInstaller { @Autowired protected PnfCustomizationRepository pnfCustomizationRepository; - @Autowired - protected ServiceInfoRepository serviceInfoRepository; - @Autowired protected WorkflowResource workflowResource; @@ -393,7 +390,7 @@ public class ToscaResourceInstaller { createToscaCsar(toscaResourceStruct); createService(toscaResourceStruct, vfResourceStruct); Service service = toscaResourceStruct.getCatalogService(); - ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service); + createServiceInfo(toscaResourceStruct, service); List vfEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); @@ -423,9 +420,8 @@ public class ToscaResourceInstaller { processServiceProxyAndConfiguration(toscaResourceStruct, service); logger.info("Saving Service: {} ", service.getModelName()); - ServiceInfo serviceResult = serviceInfoRepository.save(serviceInfo); - Service resultService = serviceResult.getService(); - correlateConfigCustomResources(resultService); + service = serviceRepo.save(service); + correlateConfigCustomResources(service); workflowResource.processWorkflows(vfResourceStructure); @@ -2902,9 +2898,9 @@ public class ToscaResourceInstaller { createToscaCsar(toscaResourceStruct); createService(toscaResourceStruct, vfResourceStruct); Service service = toscaResourceStruct.getCatalogService(); - ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service); + createServiceInfo(toscaResourceStruct, service); createServiceArtifact(service, vfResourceStruct, artifactContent); - serviceInfoRepository.save(serviceInfo); + serviceRepo.save(service); } private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) { @@ -2927,16 +2923,19 @@ public class ToscaResourceInstaller { service.setServiceArtifactList(serviceArtifactList); } - private ServiceInfo createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) { + private void createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) { + List serviceInfos = new ArrayList<>(); + ServiceInfo serviceInfo = new ServiceInfo(); String serviceInput = getServiceInput(toscaResourceStruct); serviceInfo.setServiceInput(serviceInput); String serviceProperties = getServiceProperties(toscaResourceStruct); serviceInfo.setServiceProperties(serviceProperties); - serviceInfo.setService(service); - return serviceInfo; + serviceInfos.add(serviceInfo); + + service.setServiceInfos(serviceInfos); } private String getServiceProperties(ToscaResourceStructure toscaResourceStruct) { -- cgit 1.2.3-korg