From 0216cec34a95d896ab5795174c69a110a5a51d23 Mon Sep 17 00:00:00 2001 From: "Kuleshov, Elena" Date: Sat, 3 Oct 2020 11:17:14 -0400 Subject: add work step option for failures Introduce new Policy and workStep to handle failures Reapply changes using correct camunda modeler version. Issue-ID: SO-3287 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I7e0a36305322c255f6678529f0a27c023fd983ef --- .../tasks/ExecuteBuildingBlockRainyDay.java | 3 ++- .../org/onap/so/client/exception/ExceptionBuilder.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/onap') 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 4206596c94..3b84b150e0 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 @@ -213,7 +213,8 @@ public class ExecuteBuildingBlockRainyDay { String targetState = ""; if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) { targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString(); - } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) { + } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode) + || "RollbackToCreatedNoConfiguration".equalsIgnoreCase(handlingCode)) { targetState = Status.ROLLED_BACK_TO_CREATED.toString(); } else { targetState = Status.ROLLED_BACK.toString(); 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 843cca0848..43db27917e 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 @@ -232,6 +232,20 @@ public class ExceptionBuilder { throw new BpmnError("MSOWorkflowException"); } + public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, + ONAPComponentsList extSystemErrorSource, String workStep) { + String processKey = getProcessKey(execution); + logger.info("Building a WorkflowException for Subflow"); + + WorkflowException exception = + new WorkflowException(processKey, errorCode, errorMessage, workStep, extSystemErrorSource); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("MSOWorkflowException"); + } + public WorkflowException buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) { String processKey = getProcessKey(execution); -- cgit 1.2.3-korg