add serviceDecomposition input para for deleteE2E 09/44609/1
authorYulian Han <elaine.hanyulian@huawei.com>
Wed, 25 Apr 2018 08:04:19 +0000 (16:04 +0800)
committerYulian Han <elaine.hanyulian@huawei.com>
Wed, 25 Apr 2018 08:04:19 +0000 (16:04 +0800)
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064309
Issue-ID: SO-578
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn

index f29db92..dff1ecf 100644 (file)
@@ -226,23 +226,43 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
                utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)\r
     }\r
     \r
-    public void preProcessForDeleteResource(DelegateExecution execution) {\r
-        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+       public void preProcessForDeleteResource(DelegateExecution execution) {\r
+               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
                utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled)\r
-               \r
+\r
                execution.setVariable("operationType", "delete")\r
-               \r
-               execution.setVariable("hasResourcetoDelete", false)\r
+\r
+               def  hasResourcetoDelete = false\r
                List<Resource> delResourceList =  execution.getVariable("delResourceList")\r
                if(delResourceList != null && !delResourceList.isEmpty()) {\r
-                       execution.setVariable("hasResourcetoDelete", true)\r
-               }                       \r
-               \r
-               execution.setVariable("resourceInstanceIDs", execution.getVariable("serviceRelationShip"))\r
+                       hasResourcetoDelete = true\r
+               }\r
+               execution.setVariable("hasResourcetoDelete", hasResourcetoDelete)\r
+\r
+               if(hasResourcetoDelete) {\r
+                       def jsonSlurper = new JsonSlurper()\r
+                       String serviceRelationShip = execution.getVariable("serviceRelationShip")                       \r
+                       List relationShipList =  jsonSlurper.parseText(serviceRelationShip)\r
+\r
+                       //Set the real resource instance id to the decomosed resource list\r
+                       for(Resource resource: delResourceList){\r
+                               //reset the resource instance id , because in the decompose flow ,its a random one.\r
+                               resource.setResourceId("");\r
+                               //match the resource-instance-name and the model name\r
+                               if (relationShipList != null) {\r
+                                       relationShipList.each {\r
+                                               if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){\r
+                                                       resource.setResourceId(it.resourceInstanceId);\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
                \r
-               utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)\r
+               execution.setVariable("deleteResourceList", delResourceList)\r
 \r
-    }\r
+               utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)\r
+       }\r
 \r
     public void postProcessForDeleteResource(DelegateExecution execution) {\r
         def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
index ae84d89..b331878 100644 (file)
@@ -44,6 +44,7 @@ ex.processJavaException(execution)]]></bpmn:script>
         <camunda:in source="serviceDecomposition_Original" target="serviceDecomposition_Original" />
         <camunda:in source="addResourceList" target="addResourceList" />
         <camunda:in source="delResourceList" target="delResourceList" />
+        <camunda:in source="serviceRelationShip" target="serviceRelationShip" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_04qwbbf</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing>
index 067012e..35cd039 100644 (file)
@@ -240,11 +240,10 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
         <camunda:in source="serviceType" target="serviceType" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" />
-        <camunda:in source="serviceInputParams" target="serviceInputParams" />
-        <camunda:in source="delResourceList" target="deleteResourceList" />
-        <camunda:in source="resourceInstanceIDs" target="resourceInstanceIDs" />
+        <camunda:in source="deleteResourceList" target="deleteResourceList" />
         <camunda:in source="operationType" target="operationType" />
         <camunda:in source="operationId" target="operationId" />
+        <camunda:in source="serviceDecomposition_Original" target="serviceDecomposition" />
       </bpmn2:extensionElements>
       <bpmn2:incoming>SequenceFlow_0ur34hv</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0w4t4ao</bpmn2:outgoing>
@@ -252,15 +251,11 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_0w4t4ao" sourceRef="CallActivity_11obqi0" targetRef="ScriptTask_00wgfrc" />
     <bpmn2:callActivity id="CallActivity_07pl1uw" name="Call DoCreateResources" calledElement="DoCreateResourcesV3">
       <bpmn2:extensionElements>
-        <camunda:in source="nsServiceName" target="nsServiceName" />
         <camunda:in source="serviceDescription" target="nsServiceDescription" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:in source="serviceType" target="serviceType" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:in source="operationId" target="operationId" />
-        <camunda:in source="resourceType" target="resourceType" />
-        <camunda:in source="resourceUUID" target="resourceUUID" />
-        <camunda:in source="resourceParameters" target="resourceParameters" />
         <camunda:in source="operationType" target="operationType" />
         <camunda:in source="addResourceList" target="addResourceList" />
         <camunda:in source="serviceInstanceName" target="serviceInstanceName" />