use of org.wso2.carbon.apimgt.core.exception.WorkflowException in project carbon-apimgt by wso2.
the class APIPublisherImpl method cleanupPendingTaskForAPIStateChange.
private void cleanupPendingTaskForAPIStateChange(String apiId) throws APIManagementException {
Optional<String> workflowExtRef = getWorkflowDAO().getExternalWorkflowReferenceForPendingTask(apiId, WorkflowConstants.WF_TYPE_AM_API_STATE);
if (workflowExtRef.isPresent()) {
WorkflowExecutor executor = WorkflowExecutorFactory.getInstance().getWorkflowExecutor(WorkflowConstants.WF_TYPE_AM_API_STATE);
try {
executor.cleanUpPendingTask(workflowExtRef.get());
} catch (WorkflowException e) {
String warn = "Failed to clean pending api state change task for " + apiId;
// failed cleanup processes are ignored to prevent failing the deletion process
log.warn(warn, e.getLocalizedMessage());
}
getWorkflowDAO().deleteWorkflowEntryforExternalReference(workflowExtRef.get());
}
}
Aggregations