import java.util.ArrayList;
import java.util.List;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class FlowCompletionTasks {
- private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(FlowCompletionTasks.class);
+
+ @Autowired
+ private RequestsDbClient requestDbclient;
+
+ public void updateRequestDbStatus(BuildingBlockExecution execution) {
+ try {
+ String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ if (workflowException == null) {
+ request.setStatusMessage("RequestCompletedSuccessfully");
+ request.setRequestStatus("COMPLETE");
+
+ } else {
+ request.setStatusMessage(workflowException.getErrorMessage());
+ request.setRequestStatus("FAILED");
+ }
+ request.setProgress(100L);
+ request.setLastModifiedBy("CamundaBPMN");
+
+ requestDbclient.updateInfraActiveRequests(request);
+ } catch (Exception e) {
+ logger.error("Unable to save the updated request status to the DB", e);
+ }
+ }
+
- @Autowired
- private RequestsDbClient requestDbclient;
-
- public void updateRequestDbStatus(BuildingBlockExecution execution) {
- try {
- String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
- InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
-
- WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
- if (workflowException == null) {
- request.setStatusMessage("RequestCompletedSuccessfully");
- request.setRequestStatus("COMPLETE");
-
- }
- else {
- request.setStatusMessage(workflowException.getErrorMessage());
- request.setRequestStatus("FAILED");
- }
- request.setProgress(100L);
- request.setLastModifiedBy("CamundaBPMN");
-
- requestDbclient.updateInfraActiveRequests(request);
- } catch (Exception e) {
- logger.error("Unable to save the updated request status to the DB",e);
- }
- }
-
-
}