本文整理了Java中com.evolveum.midpoint.task.api.Task.getTaskIdentifier()
方法的一些代码示例,展示了Task.getTaskIdentifier()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getTaskIdentifier()
方法的具体详情如下:
包路径:com.evolveum.midpoint.task.api.Task
类名称:Task
方法名:getTaskIdentifier
[英]Returns task (lightweight) identifier. This is an unique identification of any task, regardless whether it is persistent or transient (cf. OID). Therefore this can be used to identify all tasks, e.g. for the purposes of auditing and logging. Task identifier is assigned automatically when the task is created. It is immutable.
[中]返回任务(轻量级)标识符。这是任何任务的唯一标识,无论它是持久的还是暂时的(参见OID)。因此,这可用于识别所有任务,例如用于审计和日志记录。任务标识符在创建任务时自动分配。它是不变的。
代码示例来源:origin: Evolveum/midpoint
public static Task findByIdentifier(@NotNull String identifier, @NotNull Collection<Task> tasks) {
return tasks.stream().filter(t -> identifier.equals(t.getTaskIdentifier())).findFirst().orElse(null);
}
}
代码示例来源:origin: Evolveum/midpoint
private void scheduleSubtasksNow(List<Task> subtasks, Task masterTask, OperationResult opResult) throws SchemaException,
ObjectAlreadyExistsException, ObjectNotFoundException {
masterTask.makeWaiting(TaskWaitingReason.OTHER_TASKS, TaskUnpauseActionType.RESCHEDULE); // i.e. close for single-run tasks
masterTask.savePendingModifications(opResult);
Set<String> dependents = getDependentTasksIdentifiers(subtasks);
// first set dependents to waiting, and only after that start runnables
for (Task subtask : subtasks) {
if (dependents.contains(subtask.getTaskIdentifier())) {
subtask.makeWaiting(TaskWaitingReason.OTHER_TASKS, TaskUnpauseActionType.EXECUTE_IMMEDIATELY);
subtask.savePendingModifications(opResult);
}
}
for (Task subtask : subtasks) {
if (!dependents.contains(subtask.getTaskIdentifier())) {
taskManager.scheduleTaskNow(subtask, opResult);
}
}
}
代码示例来源:origin: Evolveum/midpoint
/**
* Beware, in order to make the change permanent, it is necessary to call commitChanges on
* "executesFirst". It is advisable not to modify underlying tasks between 'addDependency'
* and 'commitChanges' because of the savePendingModifications() mechanism that is used here.
*
* @param executesFirst
* @param executesSecond
*/
public void addDependency(WfTask executesFirst, WfTask executesSecond) {
Validate.notNull(executesFirst.getTask());
Validate.notNull(executesSecond.getTask());
LOGGER.trace("Setting dependency of {} on 'task0' {}", executesSecond, executesFirst);
executesFirst.getTask().addDependent(executesSecond.getTask().getTaskIdentifier());
}
代码示例来源:origin: Evolveum/midpoint
public static void finishRequest(Task task, SecurityHelper securityHelper) {
task.getResult().computeStatus();
ConnectionEnvironment connEnv = ConnectionEnvironment.create(SchemaConstants.CHANNEL_REST_URI);
connEnv.setSessionIdOverride(task.getTaskIdentifier());
securityHelper.auditLogout(connEnv, task);
}
代码示例来源:origin: Evolveum/midpoint
subtask.addDependent(dependent.getTaskIdentifier());
if (dependent.getExecutionStatus() == TaskExecutionStatus.SUSPENDED) {
dependent.makeWaiting(TaskWaitingReason.OTHER_TASKS, TaskUnpauseActionType.EXECUTE_IMMEDIATELY);
代码示例来源:origin: Evolveum/midpoint
private String getGroupSuffix(WfExecutionTasksSerializationScopeType scope, WfContextType wfContext, Task parentTask, Task task) {
switch (scope) {
case GLOBAL: return "";
case OBJECT:
String oid = wfContext.getObjectRef() != null ? wfContext.getObjectRef().getOid() : null;
if (oid == null) {
LOGGER.warn("No object OID present, synchronization with the scope of {} couldn't be set up for task {}", scope, task);
return null;
}
return oid;
case TARGET:
return wfContext.getTargetRef() != null ? wfContext.getTargetRef().getOid() : null; // null can occur so let's be silent then
case OPERATION:
return parentTask != null ? parentTask.getTaskIdentifier() : null; // null can occur so let's be silent then
default:
throw new AssertionError("Unknown scope: " + scope);
}
}
代码示例来源:origin: Evolveum/midpoint
PolyStringType polyStringName = new PolyStringType("Task " + task.getTaskIdentifier());
taskImpl.setNameTransient(polyStringName);
代码示例来源:origin: Evolveum/midpoint
taskManager.scheduleTasksNow(singleton(taskOid), result);
} else if (task.getExecutionStatus() == TaskExecutionStatus.RUNNABLE) {
if (taskManager.getLocallyRunningTaskByIdentifier(task.getTaskIdentifier()) != null) {
代码示例来源:origin: Evolveum/midpoint
@Override
public String addTask(PrismObject<TaskType> taskPrism, RepoAddOptions options, OperationResult parentResult) throws ObjectAlreadyExistsException, SchemaException {
OperationResult result = parentResult.createSubresult(DOT_INTERFACE + "addTask");
Task task = createTaskInstance(taskPrism, result); // perhaps redundant, but it's more convenient to work with Task than with Task prism
if (task.getTaskIdentifier() == null) {
task.getTaskPrismObject().asObjectable().setTaskIdentifier(generateTaskIdentifier().toString());
}
String oid = addTaskToRepositoryAndQuartz(task, options, result);
result.computeStatus();
return oid;
}
代码示例来源:origin: Evolveum/midpoint
connEnv.setSessionIdOverride(task.getTaskIdentifier());
UsernamePasswordAuthenticationToken token;
try {
代码示例来源:origin: Evolveum/midpoint
lastProblem = e;
problems++;
if (!task.getTaskIdentifier().equals(rootTask.getTaskIdentifier())) {
bigProblems++;
代码示例来源:origin: Evolveum/midpoint
public void addNewProposedShadow(ProvisioningContext ctx, PrismObject<ShadowType> shadowToAdd,
ProvisioningOperationState<AsynchronousOperationReturnValue<PrismObject<ShadowType>>> opState,
Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException, SecurityViolationException, EncryptionException {
if (!isUseProposedShadows(ctx)) {
return;
}
PrismObject<ShadowType> repoShadow = opState.getRepoShadow();
if (repoShadow != null) {
// TODO: should we add pending operation here?
return;
}
// This is wrong: MID-4833
repoShadow = createRepositoryShadow(ctx, shadowToAdd);
repoShadow.asObjectable().setLifecycleState(SchemaConstants.LIFECYCLE_PROPOSED);
opState.setExecutionStatus(PendingOperationExecutionStatusType.REQUESTED);
addPendingOperationAdd(repoShadow, shadowToAdd, opState, task.getTaskIdentifier());
ConstraintsChecker.onShadowAddOperation(repoShadow.asObjectable());
String oid = repositoryService.addObject(repoShadow, null, result);
repoShadow.setOid(oid);
LOGGER.trace("Proposed shadow added to the repository: {}", repoShadow);
opState.setRepoShadow(repoShadow);
}
代码示例来源:origin: Evolveum/midpoint
Task firstReloaded = taskManager.getTaskByIdentifier(firstChildTask.getTaskIdentifier(), result);
assertEquals("Didn't get correct task by identifier", firstChildTask.getOid(), firstReloaded.getOid());
secondPrerequisiteTask.setName("Second prerequisite");
secondPrerequisiteTask.setOwner(rootTask.getOwner());
secondPrerequisiteTask.addDependent(rootTask.getTaskIdentifier());
secondPrerequisiteTask.pushHandlerUri(TaskConstants.NOOP_TASK_HANDLER_URI, new ScheduleType(), null);
secondPrerequisiteTask.setExtensionPropertyValue(SchemaConstants.NOOP_DELAY_QNAME, 1500);
secondPrerequisiteTask.setExtensionPropertyValue(SchemaConstants.NOOP_STEPS_QNAME, 1);
secondPrerequisiteTask.addDependent(rootTask.getTaskIdentifier());
taskManager.switchToBackground(secondPrerequisiteTask, result);
assertEquals("Parent is not set correctly on 1st child task", rootTask.getTaskIdentifier(), firstChildTask.getParent());
secondChildTask.refresh(result);
assertEquals("Parent is not set correctly on 2nd child task", rootTask.getTaskIdentifier(), secondChildTask.getParent());
firstPrerequisiteTask.refresh(result);
assertEquals("Dependents are not set correctly on 1st prerequisite task (count differs)", 1, firstPrerequisiteTask.getDependents().size());
assertEquals("Dependents are not set correctly on 1st prerequisite task (value differs)", rootTask.getTaskIdentifier(), firstPrerequisiteTask.getDependents().get(0));
List<Task> deps = firstPrerequisiteTask.listDependents(result);
assertEquals("Dependents are not set correctly on 1st prerequisite task - listDependents - (count differs)", 1, deps.size());
secondPrerequisiteTask.refresh(result);
assertEquals("Dependents are not set correctly on 2nd prerequisite task (count differs)", 1, secondPrerequisiteTask.getDependents().size());
assertEquals("Dependents are not set correctly on 2nd prerequisite task (value differs)", rootTask.getTaskIdentifier(), secondPrerequisiteTask.getDependents().get(0));
deps = secondPrerequisiteTask.listDependents(result);
assertEquals("Dependents are not set correctly on 2nd prerequisite task - listDependents - (count differs)", 1, deps.size());
代码示例来源:origin: Evolveum/midpoint
record.setTaskIdentifier(task.getTaskIdentifier());
record.setSessionIdentifier(task.getTaskIdentifier());
代码示例来源:origin: Evolveum/midpoint
worker.setObjectRef(CloneUtil.clone(coordinatorTaskBean.getObjectRef()));
worker.setRecurrence(TaskRecurrenceType.SINGLE);
worker.setParent(coordinatorTask.getTaskIdentifier());
worker.beginWorkManagement().taskKind(TaskKindType.WORKER);
PrismContainer<Containerable> coordinatorExtension = coordinatorTaskBean.asPrismObject().findContainer(TaskType.F_EXTENSION);
代码示例来源:origin: Evolveum/midpoint
subtask.setObjectRef(CloneUtil.clone(masterTaskBean.getObjectRef()));
subtask.setRecurrence(TaskRecurrenceType.SINGLE);
subtask.setParent(masterTask.getTaskIdentifier());
boolean copyMasterExtension = applyDefaults(
p -> p.isCopyMasterExtension(masterTask),
代码示例来源:origin: Evolveum/midpoint
AssertJUnit.assertNotNull(task);
display("Task after finish", task);
AssertJUnit.assertNotNull(task.getTaskIdentifier());
assertFalse(task.getTaskIdentifier().isEmpty());
内容来源于网络,如有侵权,请联系作者删除!