Increased lock time on add graph data task and 42/100942/1
authorBoslet, Cory <cory.boslet@att.com>
Thu, 30 Jan 2020 14:50:23 +0000 (09:50 -0500)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Thu, 30 Jan 2020 14:50:24 +0000 (09:50 -0500)
Increased lock time on add graph data task and fixed error handling for
inventory failure so flow doesnt proceed
Changed build workflow exception to return the exception

Issue-ID: SO-2621
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ib247cd7e5eb0cf17579a9d72d9e8ede8a8c35e17

bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java

index 99767b0..5a52e3a 100644 (file)
@@ -25,12 +25,14 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
 import java.util.Map;
 import org.camunda.bpm.engine.delegate.BpmnError;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.logging.filter.base.ONAPComponents;
 import org.onap.logging.filter.base.ONAPComponentsList;
 import org.onap.so.bpmn.core.WorkflowException;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.ExceptionBuilder;
 import org.onap.so.constants.Status;
 import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
 import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -53,6 +55,8 @@ public class ExecuteBuildingBlockRainyDay {
     public static final String RAINY_DAY_VNF_TYPE = "rainyDayVnfType";
     public static final String RAINY_DAY_VNF_NAME = "rainyDayVnfName";
 
+    @Autowired
+    private ExceptionBuilder exceptionBuilder;
     @Autowired
     private CatalogDbClient catalogDbClient;
     @Autowired
@@ -242,9 +246,15 @@ public class ExecuteBuildingBlockRainyDay {
         try {
             String requestId = (String) execution.getVariable("mso-request-id");
             WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
+            if (exception == null) {
+                String errorMessage = (String) execution.getVariable("WorkflowExceptionMessage");
+                exception =
+                        exceptionBuilder.buildWorkflowException(execution, 500, errorMessage, ONAPComponents.EXTERNAL);
+            }
             ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource();
             InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
             Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
+
             if (isRollbackFailure == null) {
                 isRollbackFailure = false;
             }
index 903280c..0a6ce05 100644 (file)
@@ -231,6 +231,18 @@ public class ExceptionBuilder {
         throw new BpmnError("MSOWorkflowException");
     }
 
+    public WorkflowException buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
+            ONAPComponentsList extSystemErrorSource) {
+        String processKey = getProcessKey(execution);
+        logger.info("Building a WorkflowException for Subflow");
+
+        WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage, extSystemErrorSource);
+        execution.setVariable("WorkflowException", exception);
+        execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+        logger.info("Outgoing WorkflowException is {}", exception);
+        return exception;
+    }
+
     public void buildAndThrowWorkflowException(DelegateExecution execution, String errorCode, String errorMessage) {
         execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
         throw new BpmnError(errorCode, errorMessage);