use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.
the class SubtasksPanel method initLayout.
private void initLayout(boolean workflowsEnabled) {
List<IColumn<TaskDto, String>> columns = new ArrayList<IColumn<TaskDto, String>>();
columns.add(PageTasks.createTaskNameColumn(this, "SubtasksPanel.label.name"));
columns.add(PageTasks.createTaskCategoryColumn(this, "SubtasksPanel.label.category"));
columns.add(PageTasks.createTaskExecutionStatusColumn(this, "SubtasksPanel.label.executionState"));
columns.add(PageTasks.createTaskResultStatusColumn(this, "SubtasksPanel.label.result"));
//columns.add(PageTasks.createTaskDetailColumn(this, "SubtasksPanel.label.detail", workflowsEnabled));
ISortableDataProvider provider = new ListDataProvider(this, getModel());
add(new TablePanel<TaskDto>(ID_SUBTASKS_TABLE, provider, columns));
}
use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.
the class TaskSubtasksAndThreadsTabPanel method initLayout.
private void initLayout(final IModel<TaskDto> taskDtoModel) {
WebMarkupContainer threadsConfigurationPanel = new WebMarkupContainer(ID_THREADS_CONFIGURATION_PANEL);
add(threadsConfigurationPanel);
threadsConfigurationPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return taskDtoModel.getObject().configuresWorkerThreads();
}
});
final TextField<Integer> workerThreads = new TextField<>(ID_WORKER_THREADS, new PropertyModel<Integer>(taskDtoModel, TaskDto.F_WORKER_THREADS));
workerThreads.setOutputMarkupId(true);
workerThreads.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return parentPage.isEdit();
}
});
threadsConfigurationPanel.add(workerThreads);
VisibleEnableBehaviour hiddenWhenEditingOrNoSubtasks = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !parentPage.isEdit() && !taskDtoModel.getObject().getSubtasks().isEmpty();
}
};
Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
subtasksLabel.add(hiddenWhenEditingOrNoSubtasks);
add(subtasksLabel);
SubtasksPanel subtasksPanel = new SubtasksPanel(ID_SUBTASKS_PANEL, new PropertyModel<List<TaskDto>>(taskDtoModel, TaskDto.F_SUBTASKS), parentPage.getWorkflowManager().isEnabled());
subtasksPanel.add(hiddenWhenEditingOrNoSubtasks);
add(subtasksPanel);
VisibleEnableBehaviour hiddenWhenNoSubtasks = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
TaskDto taskDto = taskDtoModel.getObject();
return taskDto != null && !taskDto.getTransientSubtasks().isEmpty();
}
};
Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
workerThreadsTableLabel.add(hiddenWhenNoSubtasks);
add(workerThreadsTableLabel);
List<IColumn<WorkerThreadDto, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskName"), WorkerThreadDto.F_NAME));
columns.add(new EnumPropertyColumn<WorkerThreadDto>(createStringResourceStatic(this, "TaskStatePanel.subtaskState"), WorkerThreadDto.F_EXECUTION_STATUS));
columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskObjectsProcessed"), WorkerThreadDto.F_PROGRESS));
ISortableDataProvider<WorkerThreadDto, String> threadsProvider = new ListDataProvider<>(this, new AbstractReadOnlyModel<List<WorkerThreadDto>>() {
@Override
public List<WorkerThreadDto> getObject() {
List<WorkerThreadDto> rv = new ArrayList<>();
TaskDto taskDto = taskDtoModel.getObject();
if (taskDto != null) {
for (TaskDto subtaskDto : taskDto.getTransientSubtasks()) {
rv.add(new WorkerThreadDto(subtaskDto));
}
}
return rv;
}
});
TablePanel<WorkerThreadDto> workerThreadsTablePanel = new TablePanel<>(ID_WORKER_THREADS_TABLE, threadsProvider, columns);
workerThreadsTablePanel.add(hiddenWhenNoSubtasks);
add(workerThreadsTablePanel);
}
use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.
the class TaskWfChildPanel method getComponentsToUpdate.
public Collection<Component> getComponentsToUpdate() {
TaskDto curr = parentPage.getCurrentTaskDto();
TaskDto prev = parentPage.getPreviousTaskDto();
boolean changesChanged = prev == null || prev.getChangesBeingApproved() == null || !prev.getChangesBeingApproved().equals(curr.getChangesBeingApproved());
List<Component> rv = new ArrayList<>();
if (changesChanged) {
rv.add(get(ID_CHANGES));
} else {
curr.getChangesBeingApproved().applyFoldingFrom(prev.getChangesBeingApproved());
}
rv.add(get(ID_HISTORY));
rv.add(get(ID_CURRENT_WORK_ITEMS_CONTAINER));
rv.add(get(ID_RELATED_REQUESTS_CONTAINER));
// we exclude 'show parent' link
return rv;
}
use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.
the class TaskWfParentPanel method getComponentsToUpdate.
public Collection<Component> getComponentsToUpdate() {
TaskDto curr = parentPage.getCurrentTaskDto();
TaskDto prev = parentPage.getPreviousTaskDto();
List<TaskChangesDto> prevList = prev != null ? prev.getChangesCategorizationList() : null;
List<TaskChangesDto> currList = curr.getChangesCategorizationList();
boolean changesChanged = prev == null || !prevList.equals(currList);
List<Component> rv = new ArrayList<>();
if (changesChanged) {
rv.add(changesContainer);
} else {
for (int i = 0; i < currList.size(); i++) {
currList.get(i).applyFoldingFrom(prevList.get(i));
}
}
rv.add(processInstancesPanel);
return rv;
}
use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.
the class PageTaskEdit method refreshTaskModels.
public void refreshTaskModels() {
TaskDto oldTaskDto = taskDtoModel.getObject();
if (oldTaskDto == null) {
LOGGER.warn("Null or empty taskModel");
return;
}
TaskManager taskManager = getTaskManager();
OperationResult result = new OperationResult("refresh");
Task operationTask = taskManager.createTaskInstance("refresh");
try {
LOGGER.debug("Refreshing task {}", oldTaskDto);
TaskType taskType = loadTaskType(oldTaskDto.getOid(), operationTask, result);
TaskDto newTaskDto = prepareTaskDto(taskType, operationTask, result);
final ObjectWrapper<TaskType> newWrapper = loadObjectWrapper(taskType.asPrismObject(), operationTask, result);
previousTaskDto = currentTaskDto;
currentTaskDto = newTaskDto;
taskDtoModel.setObject(newTaskDto);
objectWrapperModel.setObject(newWrapper);
} catch (ObjectNotFoundException | SchemaException | ExpressionEvaluationException | RuntimeException | Error e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't refresh task {}", e, oldTaskDto);
}
}
Aggregations