use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskUnpauseActionType in project midpoint by Evolveum.
the class UnpauseHelper method unpauseTask.
boolean unpauseTask(TaskQuartzImpl task, OperationResult result) throws ObjectNotFoundException, SchemaException, PreconditionViolationException {
// The closeTask method is OK even if the task has become suspended in the meanwhile.
if (task.getSchedulingState() != TaskSchedulingStateType.WAITING) {
String message = "Attempted to unpause a task that is not in the WAITING state (task = " + task + ", scheduling state = " + task.getSchedulingState();
LOGGER.error(message);
result.recordFatalError(message);
return false;
}
TaskUnpauseActionType action = getUnpauseAction(task);
switch(action) {
case EXECUTE_IMMEDIATELY:
LOGGER.debug("Unpausing task using 'executeImmediately' action (scheduling it now): {}", task);
scheduleNowHelper.scheduleWaitingTaskNow(task, result);
break;
case RESCHEDULE:
if (task.isRecurring()) {
LOGGER.debug("Unpausing recurring task using 'reschedule' action (making it runnable): {}", task);
makeWaitingTaskRunnable(task, result);
} else {
LOGGER.debug("Unpausing task using 'reschedule' action (closing it, because the task is single-run): {}", task);
closeHelper.closeTask(task, result);
}
break;
case CLOSE:
LOGGER.debug("Unpausing task using 'close' action: {}", task);
closeHelper.closeTask(task, result);
break;
default:
throw new IllegalStateException("Unsupported unpause action: " + action);
}
return true;
}
Aggregations