Merge branch 'recursive-orch'
[so.git] / bpmn / so-bpmn-tasks / src / main / java / org / onap / so / bpmn / infrastructure / workflow / tasks / ExecuteBuildingBlockBuilder.java
old mode 100644 (file)
new mode 100755 (executable)
index 2bd0f2c..d7f2b85
@@ -54,6 +54,8 @@ public class ExecuteBuildingBlockBuilder {
     private static final String PNF = "Pnf";
     private static final String VFMODULE = "VfModule";
     private static final String NETWORK = "Network";
+    private static final String HEALTH_CHECK = "HealthCheckBB";
+    private static final String UPGRADE_CNF = "UpgradeVfModuleBB";
 
     protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
             List<Resource> originalResourceList, String requestId, String apiVersion, String resourceId,
@@ -108,17 +110,34 @@ public class ExecuteBuildingBlockBuilder {
             String requestId, String apiVersion, String resourceId, String requestAction, String vnfType,
             WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean replaceVnf) {
         List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
-        if (orchFlow.getFlowName().contains(SERVICE) || (orchFlow.getFlowName().contains(CONTROLLER)
+        if (orchFlow.getFlowName().contains(CHILD_SERVICE)) {
+            if (WorkflowType.SERVICE.equals(resource.getResourceType()) && resource.hasParent()) {
+                addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.SERVICE, orchFlow, requestId,
+                        apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
+                        false);
+            }
+        } else if (orchFlow.getFlowName().contains(SERVICE) || (orchFlow.getFlowName().contains(CONTROLLER)
                 && (SERVICE).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
             if (!replaceVnf) {
                 workflowResourceIds.setServiceInstanceId(resourceId);
             }
-            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.SERVICE, orchFlow, requestId,
-                    apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+            if (!resource.hasParent()) {
+                addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.SERVICE, orchFlow, requestId,
+                        apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
+                        false);
+            }
         } else if (orchFlow.getFlowName().contains(VNF)
                 || (orchFlow.getFlowName().contains(CONTROLLER) && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
             addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion,
                     resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if ((orchFlow.getFlowName().equalsIgnoreCase(HEALTH_CHECK))
+                && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope())) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion,
+                    resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
+        } else if ((orchFlow.getFlowName().equalsIgnoreCase(UPGRADE_CNF))
+                && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope())) {
+            addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion,
+                    resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false);
         } else if (orchFlow.getFlowName().contains(PNF)
                 || (orchFlow.getFlowName().contains(CONTROLLER) && (PNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
             addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.PNF, orchFlow, requestId, apiVersion,