diff options
author | Gamboa, Gilbert <gilbert.g.gamboa@att.com> | 2019-07-05 10:30:58 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-07-05 10:31:04 -0400 |
commit | cc805b184620525115c88c1a52ddfde55c73e15b (patch) | |
tree | 419e6d3573b0860d2aa18d0b462e310a2d17bef9 /bpmn/so-bpmn-tasks/src/main | |
parent | 0e2cda138f35ee6a7a8a54c29a6c4edf07d51745 (diff) |
mso will support new requeststate values
Support new request status - ROLLED_BACK, ROLLED_BACK_TO_ASSIGNED,
ROLLED_BACK_TO_CREATED, and ABORTED.
Support new request status - ROLLED_BACK, ROLLED_BACK_TO_ASSIGNED,
ROLLED_BACK_TO_CREATED, and ABORTED. Added default FAILED request
status in case rollback is not needed.
Variable rollbackTargetState needs to be returned to WorkflowAction flow
Variable rollbackTargetState needs to in to ExecuteBuildingBlock as
well. Add new RequestDb migration file to expand infra_active_requests
column request_status to 25 bytes to fit new request states.
Change-Id: I0da2f8013001a28dcc20f64eb9455e4cfd3dd197
Issue-ID: SO-2093
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 67dc9fec26..2d3f5de616 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -26,6 +26,7 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.constants.Status; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.slf4j.Logger; @@ -37,6 +38,7 @@ import org.springframework.stereotype.Component; public class WorkflowActionBBFailure { private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class); + public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState"; @Autowired private RequestsDbClient requestDbclient; @Autowired @@ -89,6 +91,8 @@ public class WorkflowActionBBFailure { rollbackErrorMsg = "Rollback has been completed successfully."; request.setRollbackStatusMessage(rollbackErrorMsg); execution.setVariable("RollbackErrorMessage", rollbackErrorMsg); + String rollbackTargetState = (String) execution.getVariable(ROLLBACK_TARGET_STATE); + request.setRequestStatus(rollbackTargetState); } else if (isRollbackFailure) { Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution); if (rollbackErrorMsgOp.isPresent()) { @@ -98,6 +102,7 @@ public class WorkflowActionBBFailure { } request.setRollbackStatusMessage(rollbackErrorMsg); execution.setVariable("RollbackErrorMessage", rollbackErrorMsg); + request.setRequestStatus(Status.FAILED.toString()); } else { Optional<String> errorMsgOp = retrieveErrorMessage(execution); if (errorMsgOp.isPresent()) { @@ -107,6 +112,12 @@ public class WorkflowActionBBFailure { } request.setStatusMessage(errorMsg); execution.setVariable("ErrorMessage", errorMsg); + String handlingCode = (String) execution.getVariable("handlingCode"); + if ("Abort".equalsIgnoreCase(handlingCode)) { + request.setRequestStatus(Status.ABORTED.toString()); + } else { + request.setRequestStatus(Status.FAILED.toString()); + } } if (ebb != null && ebb.getBuildingBlock() != null) { String flowStatus = ""; @@ -120,7 +131,6 @@ public class WorkflowActionBBFailure { } request.setProgress(Long.valueOf(100)); - request.setRequestStatus("FAILED"); request.setLastModifiedBy("CamundaBPMN"); request.setEndTime(new Timestamp(System.currentTimeMillis())); requestDbclient.updateInfraActiveRequests(request); |