Search in sources :

Example 1 with TaskDto

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));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 2 with TaskDto

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);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) EnumPropertyColumn(com.evolveum.midpoint.web.component.data.column.EnumPropertyColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) SubtasksPanel(com.evolveum.midpoint.web.page.admin.server.subtasks.SubtasksPanel) TextField(org.apache.wicket.markup.html.form.TextField) ResourceModel(org.apache.wicket.model.ResourceModel) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WorkerThreadDto(com.evolveum.midpoint.web.page.admin.server.dto.WorkerThreadDto) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 3 with TaskDto

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;
}
Also used : ArrayList(java.util.ArrayList) Component(org.apache.wicket.Component) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 4 with TaskDto

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;
}
Also used : ArrayList(java.util.ArrayList) Component(org.apache.wicket.Component) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) TaskChangesDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto)

Example 5 with TaskDto

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) TaskManager(com.evolveum.midpoint.task.api.TaskManager) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Aggregations

TaskDto (com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)17 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 Label (org.apache.wicket.markup.html.basic.Label)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 Task (com.evolveum.midpoint.task.api.Task)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)2 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)2 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)2 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)2 Component (org.apache.wicket.Component)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1