/** * Complete the external process status Based on the workflow status we will update the status * column of the Application table * * @param workFlowDTO - WorkflowDTO */ public WorkflowResponse complete(WorkflowDTO workFlowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.info("Complete Application creation Workflow.."); } String status = null; if ("CREATED".equals(workFlowDTO.getStatus().toString())) { status = APIConstants.ApplicationStatus.APPLICATION_CREATED; } else if ("REJECTED".equals(workFlowDTO.getStatus().toString())) { status = APIConstants.ApplicationStatus.APPLICATION_REJECTED; } else if ("APPROVED".equals(workFlowDTO.getStatus().toString())) { status = APIConstants.ApplicationStatus.APPLICATION_APPROVED; } ApiMgtDAO dao = ApiMgtDAO.getInstance(); try { dao.updateApplicationStatus(Integer.parseInt(workFlowDTO.getWorkflowReference()), status); } catch (APIManagementException e) { String msg = "Error occured when updating the status of the Application creation process"; log.error(msg, e); throw new WorkflowException(msg, e); } return new GeneralWorkflowResponse(); }
/** * Execute the workflow executor * * @param workFlowDTO - {@link ApplicationWorkflowDTO} * @throws WorkflowException */ public WorkflowResponse execute(WorkflowDTO workFlowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.info("Executing Application creation Workflow.."); } workFlowDTO.setStatus(WorkflowStatus.APPROVED); complete(workFlowDTO); super.publishEvents(workFlowDTO); return new GeneralWorkflowResponse(); }