From c7c76f0e6d6aacf6f1b1cd07a42360291fde7e85 Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Wed, 25 Apr 2018 16:04:19 +0800 Subject: add serviceDecomposition input para for deleteE2E Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064309 Issue-ID: SO-578 Signed-off-by: Yulian Han --- .../scripts/DoUpdateE2EServiceInstance.groovy | 42 ++++++++++++++++------ .../process/UpdateCustomE2EServiceInstance.bpmn | 1 + .../subprocess/DoUpdateE2EServiceInstance.bpmn | 9 ++--- 3 files changed, 34 insertions(+), 18 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index f29db9252f..dff1ecf68e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -226,23 +226,43 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled) } - public void preProcessForDeleteResource(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + public void preProcessForDeleteResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled) - + execution.setVariable("operationType", "delete") - - execution.setVariable("hasResourcetoDelete", false) + + def hasResourcetoDelete = false List delResourceList = execution.getVariable("delResourceList") if(delResourceList != null && !delResourceList.isEmpty()) { - execution.setVariable("hasResourcetoDelete", true) - } - - execution.setVariable("resourceInstanceIDs", execution.getVariable("serviceRelationShip")) + hasResourcetoDelete = true + } + execution.setVariable("hasResourcetoDelete", hasResourcetoDelete) + + if(hasResourcetoDelete) { + def jsonSlurper = new JsonSlurper() + String serviceRelationShip = execution.getVariable("serviceRelationShip") + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + //Set the real resource instance id to the decomosed resource list + for(Resource resource: delResourceList){ + //reset the resource instance id , because in the decompose flow ,its a random one. + resource.setResourceId(""); + //match the resource-instance-name and the model name + if (relationShipList != null) { + relationShipList.each { + if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){ + resource.setResourceId(it.resourceInstanceId); + } + } + } + } + } - utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) + execution.setVariable("deleteResourceList", delResourceList) - } + utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled) + } public void postProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index ae84d894c0..b33187852f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -44,6 +44,7 @@ ex.processJavaException(execution)]]> + SequenceFlow_04qwbbf SequenceFlow_0klbpxx diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index 067012e675..35cd0399cf 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -240,11 +240,10 @@ dcsi.preProcessAAIPUT(execution)]]> - - - + + SequenceFlow_0ur34hv SequenceFlow_0w4t4ao @@ -252,15 +251,11 @@ dcsi.preProcessAAIPUT(execution)]]> - - - - -- cgit 1.2.3-korg