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

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

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

TaskManager.getTask介绍

[英]Returns a task with specified OID. This operation will look up a task instance in the repository and return it in a form of Task object. Works only on persistent tasks.
[中]返回具有指定OID的任务。此操作将在存储库中查找任务实例,并以任务对象的形式返回它。只适用于持久性任务。

代码示例

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

public Task getShadowTask(Map<String, Object> variables, OperationResult result) throws SchemaException, ObjectNotFoundException {
  String oid = (String) variables.get(CommonProcessVariableNames.VARIABLE_MIDPOINT_TASK_OID);
  if (oid != null) {
    return taskManager.getTask(oid, result);
  } else {
    return null;
  }
}

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

public void reloadWorkerTask(OperationResult result) throws SchemaException, ObjectNotFoundException {
  workerTask = taskManager.getTask(workerTask.getOid(), null, result);
}

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

protected void assertSyncToken(String syncTaskOid, Object expectedValue, OperationResult result) throws ObjectNotFoundException, SchemaException {
  Task task = taskManager.getTask(syncTaskOid, result);
  assertSyncToken(task, expectedValue, result);
}

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

public void reloadCoordinatorTask(OperationResult result) throws SchemaException, ObjectNotFoundException {
  coordinatorTask = taskManager.getTask(coordinatorTask.getOid(), null, result);
}

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

public boolean check() throws ObjectNotFoundException, SchemaException {
  Task task = taskManager.getTask(TASK_USER_RECOMPUTE_OID, result);
  //display("Task while waiting for task manager to pick up the task", task);
  // wait until the task is finished
  if (TaskExecutionStatus.CLOSED == task.getExecutionStatus()) {
    return true;
  }
  return false;
}

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

protected void assertSyncToken(String syncTaskOid, Object expectedValue) throws ObjectNotFoundException, SchemaException {
  OperationResult result = new OperationResult(AbstractIntegrationTest.class.getName()+".assertSyncToken");
  Task task = taskManager.getTask(syncTaskOid, result);
  assertSyncToken(task, expectedValue, result);
  result.computeStatus();
  TestUtil.assertSuccess(result);
}

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

protected void assertTaskExecutionStatus(String taskOid, TaskExecutionStatus expectedExecutionStatus) throws ObjectNotFoundException, SchemaException {
  final OperationResult result = new OperationResult(AbstractIntegrationTest.class+".assertTaskExecutionStatus");
  Task task =  taskManager.getTask(taskOid, result);
  assertEquals("Wrong executionStatus in "+task, expectedExecutionStatus, task.getExecutionStatus());
}

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

@NotNull
public static Task getTask(DelegateExecution execution, OperationResult result) {
  String oid = getTaskOid(execution.getVariables());
  try {
    return getTaskManager().getTask(oid, result);
  } catch (ObjectNotFoundException|SchemaException|RuntimeException e) {
    throw new SystemException("Couldn't get task " + oid + " corresponding to process " + execution.getProcessInstanceId(), e);
  }
}

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

public boolean check() throws ObjectNotFoundException, SchemaException {
  Task task = taskManager.getTask(TASK_OPENDJ_RECON_OID, result);
  display("Task while waiting for task manager to pick up the task", task);
  // wait until the task is finished
  return task.getLastRunFinishTimestamp() != null;
}

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

public boolean check() throws ObjectNotFoundException, SchemaException {
        Task task = taskManager.getTask(TASK_OPENDJ_SYNC_OID, result);
        display("Task while waiting for task manager to pick up the task", task);
        // wait until the task is picked up
        return task.getLastRunFinishTimestamp() != null;
//                if (TaskExclusivityStatus.CLAIMED == task.getExclusivityStatus()) {
//                    // wait until the first run is finished
//                    if (task.getLastRunFinishTimestamp() == null) {
//                        return false;
//                    }
//                    return true;
//                }
//                return false;
      }

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

private Context createContext(String workerTaskOid, Supplier<Boolean> canRun,
    OperationResult result) throws SchemaException, ObjectNotFoundException {
  Context ctx = new Context(canRun);
  ctx.workerTask = taskManager.getTask(workerTaskOid, result);
  TaskWorkManagementType wsConfig = ctx.workerTask.getWorkManagement();
  if (wsConfig != null && wsConfig.getTaskKind() != null && wsConfig.getTaskKind() != TaskKindType.WORKER &&
      wsConfig.getTaskKind() != TaskKindType.STANDALONE) {
    throw new IllegalStateException("Wrong task kind for worker task " + ctx.workerTask + ": " + wsConfig.getTaskKind());
  }
  if (wsConfig != null && wsConfig.getTaskKind() == TaskKindType.WORKER) {
    ctx.coordinatorTask = getCoordinatorTask(ctx.workerTask, result);
  }
  return ctx;
}

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

@Override
  protected void assertLastScanTimestamp(String taskOid, XMLGregorianCalendar startCal, XMLGregorianCalendar endCal)
      throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException,
      ConfigurationException, ExpressionEvaluationException {
    OperationResult result = new OperationResult(TestValidityRecomputeTaskPartitioned.class.getName() + ".assertLastScanTimestamp");
    Task master = taskManager.getTask(taskOid, result);
    for (Task subtask : master.listSubtasks(result)) {
      super.assertLastScanTimestamp(subtask.getOid(), startCal, endCal);
    }
  }
}

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

@Test
public void test120DetermineObjectClassObjectClassModel() throws Exception {
  final String TEST_NAME = "test120DetermineObjectClassObjectClassModel";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(TestRefinedSchema.class.getName()  + "." + TEST_NAME);
  importObjectFromFile(TASK_RECONCILE_DUMMY_OBJECTCLASS_FILE);
  Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_OBJECTCLASS_OID, result);
  display("Task", task);
  // WHEN
  ObjectClassComplexTypeDefinition objectClass = ModelImplUtils.determineObjectClass(refinedSchemaModel, task);
  // THEN
  display("Object class", objectClass);
  display("Object class (toString)", objectClass.toString());
  deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_OBJECTCLASS_OID);
  assertObjectClass(objectClass, RESOURCE_DUMMY_ACCOUNT_OBJECTCLASS_QNAME);
}

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

@Test
public void test122DetermineObjectClassKindIntentModel() throws Exception {
  final String TEST_NAME = "test122DetermineObjectClassKindIntentModel";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(TestRefinedSchema.class.getName()  + "." + TEST_NAME);
  importObjectFromFile(TASK_RECONCILE_DUMMY_KIND_INTENT_FILE);
  Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_KIND_INTENT_OID, result);
  display("Task", task);
  // WHEN
  ObjectClassComplexTypeDefinition objectClass = ModelImplUtils.determineObjectClass(refinedSchemaModel, task);
  // THEN
  display("Object class", objectClass);
  display("Object class (toString)", objectClass.toString());
  deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_KIND_INTENT_OID);
  assertLayerRefinedObjectClass(objectClass, RESOURCE_DUMMY_PRIVILEGE_OBJECTCLASS_QNAME,
      ShadowKindType.ENTITLEMENT, "privilege", LayerType.MODEL);
}

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

@Test
public void test124DetermineObjectClassKindIntentObjectClassModel() throws Exception {
  final String TEST_NAME = "test124DetermineObjectClassKindIntentObjectClassModel";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(TestRefinedSchema.class.getName()  + "." + TEST_NAME);
  importObjectFromFile(TASK_RECONCILE_DUMMY_KIND_INTENT_OBJECTCLASS_FILE);
  Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_KIND_INTENT_OBJECTCLASS_OID, result);
  display("Task", task);
  // WHEN
  ObjectClassComplexTypeDefinition objectClass = ModelImplUtils.determineObjectClass(refinedSchemaModel, task);
  // THEN
  display("Object class", objectClass);
  display("Object class (toString)", objectClass.toString());
  deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_KIND_INTENT_OBJECTCLASS_OID);
  assertLayerRefinedObjectClass(objectClass, RESOURCE_DUMMY_PRIVILEGE_OBJECTCLASS_QNAME,
      ShadowKindType.ENTITLEMENT, "privilege", LayerType.MODEL);
}

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

@Test
public void test114DetermineObjectClassKindIntentObjectClass() throws Exception {
  final String TEST_NAME = "test114DetermineObjectClassKindIntentObjectClass";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(TestRefinedSchema.class.getName()  + "." + TEST_NAME);
  importObjectFromFile(TASK_RECONCILE_DUMMY_KIND_INTENT_OBJECTCLASS_FILE);
  Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_KIND_INTENT_OBJECTCLASS_OID, result);
  display("Task", task);
  // WHEN
  ObjectClassComplexTypeDefinition objectClass = ModelImplUtils.determineObjectClass(refinedSchema, task);
  // THEN
  display("Object class", objectClass);
  deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_KIND_INTENT_OBJECTCLASS_OID);
  assertRefinedObjectClass(objectClass, RESOURCE_DUMMY_PRIVILEGE_OBJECTCLASS_QNAME, ShadowKindType.ENTITLEMENT, "privilege");
}

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

@Test
public void test110DetermineObjectClassObjectClass() throws Exception {
  final String TEST_NAME = "test110DetermineObjectClassObjectClass";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(TestRefinedSchema.class.getName()  + "." + TEST_NAME);
  importObjectFromFile(TASK_RECONCILE_DUMMY_OBJECTCLASS_FILE);
  Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_OBJECTCLASS_OID, result);
  display("Task", task);
  // WHEN
  ObjectClassComplexTypeDefinition objectClass = ModelImplUtils.determineObjectClass(refinedSchema, task);
  // THEN
  display("Object class", objectClass);
  deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_OBJECTCLASS_OID);
  assertObjectClass(objectClass, RESOURCE_DUMMY_ACCOUNT_OBJECTCLASS_QNAME);
}

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

@Test
public void test112DetermineObjectClassKindIntent() throws Exception {
  final String TEST_NAME = "test112DetermineObjectClassKindIntent";
  TestUtil.displayTestTitle(this, TEST_NAME);
  OperationResult result = new OperationResult(TestRefinedSchema.class.getName()  + "." + TEST_NAME);
  importObjectFromFile(TASK_RECONCILE_DUMMY_KIND_INTENT_FILE);
  Task task = taskManager.getTask(TASK_RECONCILE_DUMMY_KIND_INTENT_OID, result);
  display("Task", task);
  // WHEN
  ObjectClassComplexTypeDefinition objectClass = ModelImplUtils.determineObjectClass(refinedSchema, task);
  // THEN
  display("Object class", objectClass);
  deleteObject(TaskType.class, TASK_RECONCILE_DUMMY_KIND_INTENT_OID);
  assertRefinedObjectClass(objectClass, RESOURCE_DUMMY_PRIVILEGE_OBJECTCLASS_QNAME, ShadowKindType.ENTITLEMENT, "privilege");
}

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

final Task syncCycle = taskManager.getTask(TASK_OPENDJ_SYNC_OID, result);
AssertJUnit.assertNotNull(syncCycle);

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

@Test
public void test010Sanity() throws Exception {
  final String TEST_NAME = "test010Sanity";
  TestUtil.displayTestTitle(TEST_NAME);
  final OperationResult result = new OperationResult(TestSynchronization.class.getName()
      + "." + TEST_NAME);
  // WHEN
  PrismObject<ResourceType> resource = provisioningService.getObject(ResourceType.class, resourceType.getOid(), null, taskManager.createTaskInstance(), result);
  
  // THEN
  assertNotNull("Resource is null", resource);
  display("getObject(resource)", resource);
  
  result.computeStatus();
  display("getObject(resource) result", result);
  TestUtil.assertSuccess(result);
  
  // Make sure these were generated
  assertNotNull("No resource schema", resource.asObjectable().getSchema());
  assertNotNull("No native capabilities", resource.asObjectable().getCapabilities().getNative());
  Task syncTask = taskManager.getTask(SYNC_TASK_OID, result);
  AssertJUnit.assertNotNull(syncTask);
  assertSyncToken(syncTask, 0, result);
}

相关文章