use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class PageTaskEdit method loadTaskType.
TaskType loadTaskType(String taskOid, Task operationTask, OperationResult result) {
TaskType taskType = null;
try {
Collection<SelectorOptions<GetOperationOptions>> options = GetOperationOptions.retrieveItemsNamed(TaskType.F_SUBTASK, TaskType.F_NODE_AS_OBSERVED, TaskType.F_NEXT_RUN_START_TIMESTAMP, TaskType.F_NEXT_RETRY_TIMESTAMP, new ItemPath(TaskType.F_WORKFLOW_CONTEXT, WfContextType.F_WORK_ITEM));
options.addAll(GetOperationOptions.resolveItemsNamed(new ItemPath(TaskType.F_WORKFLOW_CONTEXT, WfContextType.F_REQUESTER_REF)));
taskType = getModelService().getObject(TaskType.class, taskOid, options, operationTask, result).asObjectable();
result.computeStatus();
} catch (Exception ex) {
result.recordFatalError("Couldn't get task.", ex);
}
return taskType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method createResourceConfigList.
private List<ResourceConfigurationDto> createResourceConfigList(ResourceType resource) {
OperationResult result = new OperationResult(OPERATION_SEARCH_TASKS_FOR_RESOURCE);
List<PrismObject<TaskType>> tasks = WebModelServiceUtils.searchObjects(TaskType.class, QueryBuilder.queryFor(TaskType.class, parentPage.getPrismContext()).item(TaskType.F_OBJECT_REF).ref(resource.getOid()).build(), result, parentPage);
List<ResourceConfigurationDto> configs = new ArrayList<>();
if (resource.getSchemaHandling() == null) {
return configs;
}
List<ResourceObjectTypeDefinitionType> objectTypes = resource.getSchemaHandling().getObjectType();
if (objectTypes == null) {
return configs;
}
try {
for (ResourceObjectTypeDefinitionType objectType : objectTypes) {
ObjectSynchronizationType obejctSynchronization = null;
if (resource.getSynchronization() != null && resource.getSynchronization().getObjectSynchronization() != null) {
obejctSynchronization = getSynchronizationFor(objectType, resource.getSynchronization().getObjectSynchronization(), resource.asPrismObject());
}
List<TaskType> syncTask = new ArrayList<>();
if (obejctSynchronization != null) {
syncTask = getTaskFor(tasks, obejctSynchronization, resource.asPrismObject());
}
ResourceConfigurationDto resourceConfig = new ResourceConfigurationDto(objectType, obejctSynchronization != null, syncTask);
configs.add(resourceConfig);
}
} catch (SchemaException ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Could not determine resource configuration", ex);
}
return configs;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class ResourceTasksPanel method createTaskModel.
private ListModel<TaskType> createTaskModel(PrismObject<ResourceType> object) {
OperationResult result = new OperationResult(OPERATION_LOAD_TASKS);
List<PrismObject<TaskType>> tasks = WebModelServiceUtils.searchObjects(TaskType.class, QueryBuilder.queryFor(TaskType.class, pageBase.getPrismContext()).item(TaskType.F_OBJECT_REF).ref(object.getOid()).build(), result, pageBase);
List<TaskType> tasksType = new ArrayList<TaskType>();
for (PrismObject<TaskType> task : tasks) {
tasksType.add(task.asObjectable());
}
return new ListModel<>(tasksType);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class AbstractRoleMemberPanel method executeMemberOperation.
protected void executeMemberOperation(Task operationalTask, QName type, ObjectQuery memberQuery, ObjectDelta delta, String category, AjaxRequestTarget target) {
OperationResult parentResult = operationalTask.getResult();
try {
ModelExecuteOptions options = TaskCategory.EXECUTE_CHANGES.equals(category) ? // This was originally in ExecuteChangesTaskHandler, now it's transferred through task extension.
ModelExecuteOptions.createReconcile() : null;
TaskType task = WebComponentUtil.createSingleRecurrenceTask(parentResult.getOperation(), type, memberQuery, delta, options, category, getPageBase());
WebModelServiceUtils.runTask(task, operationalTask, parentResult, getPageBase());
} catch (SchemaException e) {
parentResult.recordFatalError(parentResult.getOperation(), e);
LoggingUtils.logUnexpectedException(LOGGER, "Failed to execute operation " + parentResult.getOperation(), e);
target.add(getPageBase().getFeedbackPanel());
}
target.add(getPageBase().getFeedbackPanel());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType in project midpoint by Evolveum.
the class ProcessInstanceDtoProvider method internalIterator.
@Override
public Iterator<? extends ProcessInstanceDto> internalIterator(long first, long count) {
getAvailableData().clear();
Task opTask = getTaskManager().createTaskInstance(OPERATION_LIST_ITEMS);
OperationResult result = opTask.getResult();
try {
// SortParam sortParam = getSort();
// OrderDirectionType order;
// if (sortParam.isAscending()) {
// order = OrderDirectionType.ASCENDING;
// } else {
// order = OrderDirectionType.DESCENDING;
// }
ObjectQuery query = getObjectQuery();
// we know the paging object is not null
query.getPaging().setOffset(safeLongToInteger(first));
query.getPaging().setMaxSize(safeLongToInteger(count));
Collection<SelectorOptions<GetOperationOptions>> options = createCollection(createResolveNames());
List<PrismObject<TaskType>> tasks = getModel().searchObjects(TaskType.class, query, options, opTask, result);
for (PrismObject<TaskType> task : tasks) {
try {
getAvailableData().add(new ProcessInstanceDto(task.asObjectable()));
} catch (Exception e) {
LoggingUtils.logUnexpectedException(LOGGER, "Unhandled exception when listing workflow task {}", e, task);
result.recordPartialError("Couldn't list process instance.", e);
}
}
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Unhandled exception when listing wf-related tasks", ex);
result.recordFatalError("Couldn't list wf-related tasks.", ex);
}
if (result.isUnknown()) {
result.computeStatus();
}
if (!result.isSuccess()) {
getPage().showResult(result);
}
return getAvailableData().iterator();
}
Aggregations