use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class TaskStateManager method resumeTask.
public void resumeTask(String taskOid, OperationResult result) throws SchemaException, ObjectNotFoundException {
TaskQuartzImpl task = taskRetriever.getTaskPlain(taskOid, result);
resumeHelper.resumeTask(task, result);
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class ResumeHelper method getOidsToResume.
@NotNull
private List<String> getOidsToResume(String rootTaskOid, OperationResult result) throws ObjectNotFoundException, SchemaException {
TaskQuartzImpl root = taskRetriever.getTaskPlain(rootTaskOid, result);
List<TaskQuartzImpl> subtasks = root.listSubtasksDeeply(true, result);
List<String> oidsToResume = new ArrayList<>(subtasks.size() + 1);
if (root.getSchedulingState() == TaskSchedulingStateType.SUSPENDED) {
oidsToResume.add(rootTaskOid);
}
for (Task subtask : subtasks) {
if (subtask.getSchedulingState() == TaskSchedulingStateType.SUSPENDED) {
oidsToResume.add(subtask.getOid());
}
}
return oidsToResume;
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class SuspendAndDeleteHelper method getTasksToBeDeleted.
@NotNull
private List<TaskQuartzImpl> getTasksToBeDeleted(String taskOid, boolean alsoSubtasks, OperationResult result) throws ObjectNotFoundException, SchemaException {
List<TaskQuartzImpl> tasksToBeDeleted = new ArrayList<>();
TaskQuartzImpl thisTask = taskRetriever.getTaskPlain(taskOid, result);
tasksToBeDeleted.add(thisTask);
if (alsoSubtasks) {
tasksToBeDeleted.addAll(thisTask.listSubtasksDeeply(true, result));
}
return tasksToBeDeleted;
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class SuspendAndDeleteHelper method suspendTaskTree.
public boolean suspendTaskTree(String rootTaskOid, long waitTime, OperationResult result) throws SchemaException, ObjectNotFoundException {
List<TaskQuartzImpl> allTasks = new ArrayList<>();
TaskQuartzImpl root = taskRetriever.getTaskPlain(rootTaskOid, result);
LOGGER.info("Suspending task tree for {}; {}.", root, waitingInfo(waitTime));
allTasks.add(root);
allTasks.addAll(root.listSubtasksDeeply(true, result));
return suspendTasksInternal(allTasks, waitTime, result);
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class TaskRetriever method getTask.
/**
* Connects to the remote node if needed.
*/
@NotNull
public TaskQuartzImpl getTask(String oid, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws SchemaException, ObjectNotFoundException {
try {
// returns null if noFetch is set
ClusterStatusInformation csi = clusterStatusInformationRetriever.getClusterStatusInformation(options, TaskType.class, true, result);
PrismObject<TaskType> taskPrism = getTaskFromRemoteNode(oid, options, csi, result);
if (taskPrism == null) {
taskPrism = repositoryService.getObject(TaskType.class, oid, options, result);
}
TaskQuartzImpl task = taskInstantiator.createTaskInstance(taskPrism, result);
addTransientTaskInformation(task, csi, SelectorOptions.hasToLoadPath(TaskType.F_NEXT_RUN_START_TIMESTAMP, options), SelectorOptions.hasToLoadPath(TaskType.F_NEXT_RETRY_TIMESTAMP, options), SelectorOptions.hasToLoadPath(TaskType.F_NODE_AS_OBSERVED, options), result);
if (SelectorOptions.hasToLoadPath(TaskType.F_SUBTASK_REF, options)) {
fillInSubtasks(task, csi, options, result);
}
updateFromTaskInMemory(task);
return task;
} catch (Throwable t) {
result.recordFatalError(t);
throw t;
} finally {
result.computeStatusIfUnknown();
}
}
Aggregations