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

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

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

Task.getName介绍

[英]Returns human-readable name of the task.
[中]返回任务的可读名称。

代码示例

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

private static void appendLastFailuresInformation(String operationNamePrefix, Task task, boolean subtask, OperationResult result) {
  List<String> failures = task.getLastFailures();
  if (!failures.isEmpty()) {
    StringBuilder sb = new StringBuilder();
    if (failures.size() < IterativeTaskInformation.LAST_FAILURES_KEPT) {
      sb.append("Failures (").append(failures.size()).append(")");
    } else {
      sb.append("Last ").append(IterativeTaskInformation.LAST_FAILURES_KEPT).append(" failures");
    }
    if (subtask) {
      sb.append(" in subtask ").append(task.getName());
    }
    sb.append(":\n");
    failures.forEach(f -> sb.append(f).append("\n"));
    result.createSubresult(operationNamePrefix + ".errors")
        .recordStatus(OperationResultStatus.NOT_APPLICABLE, sb.toString());
  }
}

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

WorkerKey(Task worker) {    // objects created by this constructor should be used only for matching and comparisons
  this(worker.getExecutionGroup(), PolyString.getOrig(worker.getName()));
}

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

@Override
protected String getBody(Event event, GeneralNotifierType generalNotifierType, String transport, Task opTask, OperationResult opResult) throws SchemaException {
  final TaskEvent taskEvent = (TaskEvent) event;
  final Task task = taskEvent.getTask();
  final String taskName = PolyString.getOrig(task.getName());
  StringBuilder body = new StringBuilder();
  body.append("Notification about task-related operation.\n\n");
  body.append("Task: ").append(taskName).append("\n");
  body.append("Handler: ").append(task.getHandlerUri()).append("\n\n");
  if (taskEvent.getTaskRunResult() != null) {
    body.append("Run result status: ").append(taskEvent.getTaskRunResult().getRunResultStatus()).append("\n");
  }
  body.append("Status: ").append(taskEvent.getOperationResultStatus()).append("\n");
  String message = taskEvent.getMessage();
  if (StringUtils.isNotBlank(message)) {
    body.append("Message: ").append(message).append("\n");
  }
  body.append("Progress: ").append(taskEvent.getProgress()).append("\n");
  body.append("\n");
  body.append("Notification created on: ").append(new Date()).append("\n\n");
  if (task.getOwner() != null) {
    UserType owner = task.getOwner().asObjectable();
    body.append("Task owner: ");
    body.append(owner.getFullName()).append(" (").append(owner.getName()).append(")");
    body.append("\n");
  }
  body.append("Channel: ").append(event.getChannel()).append("\n\n");
  return body.toString();
}

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

@Override
protected String getSubject(Event event, GeneralNotifierType generalNotifierType, String transport, Task task, OperationResult result) {
  final TaskEvent taskEvent = (TaskEvent) event;
  final String taskName = PolyString.getOrig(taskEvent.getTask().getName());
  if (event.isAdd()) {
    return "Task '" + taskName + "' start notification";
  } else if (event.isDelete()) {
    return "Task '" + taskName + "' finish notification: " + taskEvent.getOperationResultStatus();
  } else {
    return "(unknown " + taskName + " operation)";
  }
}

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

private WorkerKey createWorkerKey(String nodeIdentifier, int index, WorkerTasksPerNodeConfigurationType perNodeConfig,
    WorkersManagementType workersCfg, Task coordinatorTask) {
  Map<String, String> replacements = new HashMap<>();
  replacements.put("node", nodeIdentifier);
  replacements.put("index", String.valueOf(index));
  replacements.put("coordinatorTaskName", coordinatorTask.getName().getOrig());
  String nameTemplate;
  if (perNodeConfig.getTaskName() != null) {
    nameTemplate = perNodeConfig.getTaskName();
  } else if (workersCfg.getTaskName() != null) {
    nameTemplate = workersCfg.getTaskName();
  } else {
    nameTemplate = "{coordinatorTaskName} ({node}:{index})";
  }
  String name = TemplateUtil.replace(nameTemplate, replacements);
  String executionGroupTemplate = defaultIfNull(perNodeConfig.getExecutionGroup(), "{node}");
  String executionGroup = MiscUtil.nullIfEmpty(TemplateUtil.replace(executionGroupTemplate, replacements));
  return new WorkerKey(executionGroup, name);
}

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

@Override
public TaskRunResult run(Task task) {
  OperationResult result = task.getResult().createSubresult(WaitForTasksTaskHandler.class.getName()+".run");
  result.recordInProgress();
  LOGGER.debug("WaitForTasksTaskHandler run starting; in task " + task.getName());
  try {
    // todo resolve this brutal hack
    taskManagerImpl.pauseTask(task, TaskWaitingReason.OTHER, result);
    task.startWaitingForTasksImmediate(result);
  } catch (SchemaException | ObjectNotFoundException e) {
    throw new SystemException("Couldn't mark task as waiting for prerequisite tasks", e);       // should not occur; will be handled by task runner
  }
  LOGGER.debug("WaitForTasksTaskHandler run finishing; in task " + task.getName());
  result.computeStatus();
  TaskRunResult runResult = new TaskRunResult();
  runResult.setOperationResult(result);
  runResult.setRunResultStatus(TaskRunResultStatus.FINISHED);
  return runResult;
}

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

if (task.getName() == null) {
  PolyStringType polyStringName = new PolyStringType("Task " + task.getTaskIdentifier());
  taskImpl.setNameTransient(polyStringName);

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

TaskRunResult runResult = new TaskRunResult();
LOGGER.info("WaitForSubtasksByPollingTaskHandler run starting; in task " + task.getName());
LOGGER.info("WaitForSubtasksByPollingTaskHandler run finishing; in task " + task.getName());
return runResult;

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

runResult.setOperationResult(opResult);
LOGGER.info("JdbcPingTaskHandler run finishing; progress = " + task.getProgress() + " in task " + task.getName());
LOGGER.info("Connection statistics: {}", connectionStatistics);
LOGGER.info("Query statistics: {}", queryStatistics);

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

assertEquals("Wrong # of partitions", 3, subtasks.size());
Task second = subtasks.stream().filter(t -> t.getName().getOrig().contains("(2)")).findFirst().orElse(null);
Task third = subtasks.stream().filter(t -> t.getName().getOrig().contains("(3)")).findFirst().orElse(null);
assertNotNull("Second-phase task was not created", second);
assertNotNull("Third-phase task was not created", third);

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

assertEquals("Wrong # of partitions", 3, subtasks.size());
Task second = subtasks.stream().filter(t -> t.getName().getOrig().contains("(2)")).findFirst().orElse(null);
Task third = subtasks.stream().filter(t -> t.getName().getOrig().contains("(3)")).findFirst().orElse(null);
assertNotNull("Second-phase task was not created", second);
assertNotNull("Third-phase task was not created", third);

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

freshRootTask.getName().getOrig() + " (" + freshRootTask.getExecutionStatus() + "/" + freshRootTask
    .getNode() + "/" + freshRootTask.getProgress() + ") ["
    + waiting + "]";

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

Map<String, String> replacements = new HashMap<>();
replacements.put("index", String.valueOf(index));
replacements.put("masterTaskName", String.valueOf(masterTask.getName().getOrig()));
replacements.put("masterTaskHandlerUri", masterTask.getHandlerUri());

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

logger.trace("Task from repo: " + task001.debugDump());
AssertJUnit.assertEquals(TaskBinding.LOOSE, task001.getBinding());
PrismAsserts.assertEqualsPolyString("Name not", newname, task001.getName());

相关文章