diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-01-30 09:50:23 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-01-30 09:50:24 -0500 |
commit | 0a70df3984208a80060080f3cba20da7779765bb (patch) | |
tree | fe35480844d503e57122cdb722cb4d94f2f135b1 /bpmn/MSOCommonBPMN/src/main | |
parent | f39f99626d9eae25d13b313cdcf908f91c042496 (diff) |
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) <mb388a@att.com>
Change-Id: Ib247cd7e5eb0cf17579a9d72d9e8ede8a8c35e17
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
2 files changed, 22 insertions, 0 deletions
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; @@ -54,6 +56,8 @@ public class ExecuteBuildingBlockRainyDay { public static final String RAINY_DAY_VNF_NAME = "rainyDayVnfName"; @Autowired + private ExceptionBuilder exceptionBuilder; + @Autowired private CatalogDbClient catalogDbClient; @Autowired private RequestsDbClient requestDbclient; @@ -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); |