package foundation.workflow;
|
|
import foundation.dao.DataWriter;
|
import foundation.exception.BusinessException;
|
|
public class GlobalExceptionCenter {
|
|
public static void error(WorkFlowRuntime workflow, Exception exception) {
|
if (exception instanceof BusinessException) {
|
error(workflow, (BusinessException)exception);
|
}
|
}
|
|
public static void error(WorkStep step, Exception exception) {
|
if (exception instanceof BusinessException) {
|
error(step, (BusinessException)exception);
|
}
|
|
}
|
|
public static void warn(WorkStep step, Exception exception) {
|
if (exception instanceof BusinessException) {
|
warn(step, (BusinessException)exception);
|
}
|
|
}
|
|
public static void error(WorkFlowRuntime workflow, BusinessException exception) {
|
workflow.terminate();
|
|
DataWriter dataWriter = workflow.getDataWriter();
|
|
if (dataWriter != null) {
|
dataWriter.reportOneError(workflow.getOperator(), exception.getMessage());
|
}
|
|
}
|
|
public static void error(WorkStep step, BusinessException exception) {
|
step.terminateTask();
|
|
DataWriter dataWriter = step.getDataWriter();
|
|
if (dataWriter != null) {
|
dataWriter.reportOneError(step.getActionName(), exception.getMessage());
|
}
|
|
}
|
|
public static void warn(WorkStep step, BusinessException exception) {
|
DataWriter dataWriter = step.getDataWriter();
|
|
if (dataWriter != null) {
|
dataWriter.reportOneAlertValidation(exception.getMessage());
|
}
|
}
|
}
|