From 0a70df3984208a80060080f3cba20da7779765bb Mon Sep 17 00:00:00 2001 From: "Boslet, Cory" Date: Thu, 30 Jan 2020 09:50:23 -0500 Subject: Increased lock time on add graph data task and 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) Change-Id: Ib247cd7e5eb0cf17579a9d72d9e8ede8a8c35e17 --- .../tasks/ExecuteBuildingBlockRainyDay.java | 10 ++++++++++ .../java/org/onap/so/client/exception/ExceptionBuilder.java | 12 ++++++++++++ 2 files changed, 22 insertions(+) (limited to 'bpmn/MSOCommonBPMN/src/main/java') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index 99767b0405..5a52e3a49d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -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; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 903280ce05..0a6ce05a06 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -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); -- cgit 1.2.3-korg