com.evolveum.midpoint.task.api.TaskManager.suspendAndDeleteTasks()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中com.evolveum.midpoint.task.api.TaskManager.suspendAndDeleteTasks()方法的一些代码示例,展示了TaskManager.suspendAndDeleteTasks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TaskManager.suspendAndDeleteTasks()方法的具体详情如下:
包路径:com.evolveum.midpoint.task.api.TaskManager
类名称:TaskManager
方法名:suspendAndDeleteTasks

TaskManager.suspendAndDeleteTasks介绍

[英]Suspends tasks and deletes them.
[中]暂停任务并删除它们。

代码示例

代码示例来源:origin: Evolveum/midpoint

@Override
public void suspendAndDeleteTasks(Collection<String> taskOids, long waitForStop, boolean alsoSubtasks, Task operationTask, OperationResult parentResult) throws SecurityViolationException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException {
  authorizeTaskCollectionOperation(ModelAuthorizationAction.DELETE, taskOids, operationTask, parentResult);
  taskManager.suspendAndDeleteTasks(taskOids, waitForStop, alsoSubtasks, parentResult);
}

代码示例来源:origin: Evolveum/midpoint

@SuppressWarnings("unused")
public void reimportTriggerTask(OperationResult result) throws FileNotFoundException {
  taskManager.suspendAndDeleteTasks(singletonList(TASK_TRIGGER_SCANNER_OID), 60000L, true, result);
  importObjectFromFile(TASK_TRIGGER_SCANNER_FILE, result);
}

代码示例来源:origin: Evolveum/midpoint

protected void resetTriggerTask(String taskOid, File taskFile, OperationResult result)
    throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException, FileNotFoundException {
  taskManager.suspendAndDeleteTasks(Collections.singletonList(taskOid), 60000L, true, result);
  importObjectFromFile(taskFile, result);
  taskManager.suspendTasks(Collections.singletonList(taskOid), 60000L, result);
  modifySystemObjectInRepo(TaskType.class, taskOid,
      prismContext.deltaFor(TaskType.class)
          .item(TaskType.F_SCHEDULE).replace()
          .asItemDeltas(),
      result);
  taskManager.resumeTasks(singleton(taskOid), result);
}

代码示例来源:origin: Evolveum/midpoint

public void deleteWorkersAndWorkState(String coordinatorTaskOid, long subtasksWaitTime, OperationResult result)
      throws SchemaException, ObjectNotFoundException {
    Task coordinatorTask = taskManager.getTask(coordinatorTaskOid, result);
    if (coordinatorTask.getKind() != TaskKindType.COORDINATOR) {
      throw new IllegalArgumentException("Task is not a coordinator task: " + coordinatorTask);
    }
    if (coordinatorTask.getExecutionStatus() == TaskExecutionStatus.WAITING) {
      throw new IllegalStateException("Couldn't delete workers and work state while operation is in progress (coordinator state is WAITING): " + coordinatorTask);
    }
    if (coordinatorTask.getExecutionStatus() == TaskExecutionStatus.RUNNABLE && coordinatorTask.getNodeAsObserved() != null) {
      throw new IllegalStateException("Couldn't delete workers and work state while operation is in progress (coordinator "
          + "state is RUNNABLE and it is executing on " + coordinatorTask.getNodeAsObserved() + "): " + coordinatorTask);
    }
    List<Task> subtasks = coordinatorTask.listSubtasks(true, result);
    taskManager.suspendAndDeleteTasks(TaskUtil.tasksToOids(subtasks), subtasksWaitTime, true, result);
    List<ItemDelta<?, ?>> itemDeltas = prismContext.deltaFor(TaskType.class)
        .item(TaskType.F_WORK_STATE).replace()
        .asItemDeltas();
    try {
      taskManager.modifyTask(coordinatorTaskOid, itemDeltas, result);
    } catch (ObjectAlreadyExistsException e) {
      throw new IllegalStateException("Unexpected exception: " + e.getMessage(), e);
    }
  }
}

相关文章