Search in sources :

Example 11 with TaskDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.

the class PageTaskEdit method createPageTitleModel.

@Override
protected IModel<String> createPageTitleModel() {
    TaskDto taskDto = taskDtoModel != null ? taskDtoModel.getObject() : null;
    String suffix;
    if (taskDto != null && taskDto.isWorkflowParent()) {
        suffix = ".wfOperation";
    } else if (taskDto != null && taskDto.isWorkflowChild()) {
        suffix = ".wfRequest";
    } else {
        suffix = "";
    }
    return createStringResource("PageTaskEdit.title" + suffix);
}
Also used : TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 12 with TaskDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.

the class TaskButtonsVisibility method computeResumeVisible.

public boolean computeResumeVisible(PageTaskEdit parentPage) {
    final TaskDto taskDto = parentPage.getTaskDto();
    resumeVisible = !parentPage.isEdit() && (taskDto.isSuspended() || (taskDto.isClosed() && taskDto.isRecurring())) && (!taskDto.isWorkflow() || parentPage.isShowAdvanced()) && parentPage.canResume();
    return resumeVisible;
}
Also used : TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 13 with TaskDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.

the class TaskButtonsVisibility method computeRunNowVisible.

public boolean computeRunNowVisible(PageTaskEdit parentPage) {
    final TaskDto taskDto = parentPage.getTaskDto();
    runNowVisible = !parentPage.isEdit() && (taskDto.isRunnable() || (taskDto.isClosed() && !taskDto.isRecurring())) && (!taskDto.isWorkflow() || parentPage.isShowAdvanced()) && parentPage.canRunNow();
    return runNowVisible;
}
Also used : TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 14 with TaskDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.

the class TaskButtonsVisibility method computeStopVisible.

public boolean computeStopVisible(PageTaskEdit parentPage) {
    final TaskDto taskDto = parentPage.getTaskDto();
    stopVisible = !parentPage.isEdit() && taskDto.isWorkflowChild() && !taskDto.isClosed() && parentPage.canStop();
    return stopVisible;
}
Also used : TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 15 with TaskDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskDto in project midpoint by Evolveum.

the class IterativeInformationPanel method initLayout.

protected void initLayout() {
    Label executionTime = new Label(ID_EXECUTION_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskDto dto = getModel().getObject().getTaskDto();
            if (dto == null) {
                return null;
            }
            Long started = dto.getLastRunStartTimestampLong();
            Long finished = dto.getLastRunFinishTimestampLong();
            if (started == null) {
                return null;
            }
            if (TaskDtoExecutionStatus.RUNNING.equals(dto.getExecution()) || finished == null || finished < started) {
                return getString("TaskStatePanel.message.executionTime.notFinished", formatDate(new Date(started)), DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - started));
            } else {
                return getString("TaskStatePanel.message.executionTime.finished", formatDate(new Date(started)), formatDate(new Date(finished)), DurationFormatUtils.formatDurationHMS(finished - started));
            }
        }
    });
    add(executionTime);
    Label processedSuccess = new Label(ID_OBJECTS_PROCESSED_SUCCESS, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getTotalSuccessCount() == 0) {
                return "0";
            } else {
                return getString("TaskStatePanel.message.objectsProcessed", info.getTotalSuccessCount());
            }
        }
    });
    add(processedSuccess);
    Label processedSuccessTime = new Label(ID_OBJECTS_PROCESSED_SUCCESS_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getTotalSuccessCount() == 0) {
                return null;
            } else {
                return getString("TaskStatePanel.message.objectsProcessedTime", info.getTotalSuccessDuration() / 1000, info.getTotalSuccessDuration() / info.getTotalSuccessCount());
            }
        }
    });
    add(processedSuccessTime);
    Label lastProcessedSuccess = new Label(ID_LAST_OBJECT_PROCESSED_SUCCESS, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getLastSuccessObjectDisplayName() == null) {
                return null;
            } else {
                return getString("TaskStatePanel.message.lastObjectProcessed", info.getLastSuccessObjectDisplayName());
            }
        }
    });
    add(lastProcessedSuccess);
    Label lastProcessedSuccessTime = new Label(ID_LAST_OBJECT_PROCESSED_SUCCESS_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getLastSuccessEndTimestamp() == null) {
                return null;
            } else {
                if (showAgo(dto)) {
                    return getString("TaskStatePanel.message.timeInfoWithDurationAndAgo", formatDate(info.getLastSuccessEndTimestamp()), DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - XmlTypeConverter.toMillis(info.getLastSuccessEndTimestamp()), true, true), info.getLastSuccessDuration());
                } else {
                    return getString("TaskStatePanel.message.timeInfoWithDuration", formatDate(info.getLastSuccessEndTimestamp()), info.getLastSuccessDuration());
                }
            }
        }
    });
    add(lastProcessedSuccessTime);
    Label processedFailure = new Label(ID_OBJECTS_PROCESSED_FAILURE, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getTotalFailureCount() == 0) {
                return "0";
            } else {
                return getString("TaskStatePanel.message.objectsProcessed", info.getTotalFailureCount());
            }
        }
    });
    add(processedFailure);
    Label processedFailureTime = new Label(ID_OBJECTS_PROCESSED_FAILURE_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getTotalFailureCount() == 0) {
                return null;
            } else {
                return getString("TaskStatePanel.message.objectsProcessedTime", info.getTotalFailureDuration() / 1000, info.getTotalFailureDuration() / info.getTotalFailureCount());
            }
        }
    });
    add(processedFailureTime);
    Label lastProcessedFailure = new Label(ID_LAST_OBJECT_PROCESSED_FAILURE, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getLastFailureObjectDisplayName() == null) {
                return null;
            } else {
                return getString("TaskStatePanel.message.lastObjectProcessed", info.getLastFailureObjectDisplayName());
            }
        }
    });
    add(lastProcessedFailure);
    Label lastProcessedFailureTime = new Label(ID_LAST_OBJECT_PROCESSED_FAILURE_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getLastFailureEndTimestamp() == null) {
                return null;
            } else {
                if (showAgo(dto)) {
                    return getString("TaskStatePanel.message.timeInfoWithDurationAndAgo", formatDate(info.getLastFailureEndTimestamp()), DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - XmlTypeConverter.toMillis(info.getLastFailureEndTimestamp()), true, true), info.getLastFailureDuration());
                } else {
                    return getString("TaskStatePanel.message.timeInfoWithDuration", formatDate(info.getLastFailureEndTimestamp()), info.getLastFailureDuration());
                }
            }
        }
    });
    add(lastProcessedFailureTime);
    Label lastError = new Label(ID_LAST_ERROR, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            return info.getLastFailureExceptionMessage();
        }
    });
    add(lastError);
    Label currentObjectProcessed = new Label(ID_CURRENT_OBJECT_PROCESSED, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            return info.getCurrentObjectDisplayName();
        }
    });
    add(currentObjectProcessed);
    Label currentObjectProcessedTime = new Label(ID_CURRENT_OBJECT_PROCESSED_TIME, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            if (info.getCurrentObjectStartTimestamp() == null) {
                return null;
            } else {
                return getString("TaskStatePanel.message.timeInfoWithAgo", formatDate(info.getCurrentObjectStartTimestamp()), DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - XmlTypeConverter.toMillis(info.getCurrentObjectStartTimestamp()), true, true));
            }
        }
    });
    add(currentObjectProcessedTime);
    Label objectsTotal = new Label(ID_OBJECTS_TOTAL, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskCurrentStateDto dto = getModelObject();
            if (dto == null) {
                return null;
            }
            IterativeTaskInformationType info = dto.getIterativeTaskInformationType();
            if (info == null) {
                return null;
            }
            int objectsTotal = info.getTotalSuccessCount() + info.getTotalFailureCount();
            if (WALL_CLOCK_AVG_CATEGORIES.contains(dto.getTaskDto().getCategory())) {
                Long avg = getWallClockAverage(dto, objectsTotal);
                if (avg != null) {
                    return getString("TaskStatePanel.message.objectsTotal", objectsTotal, avg);
                }
            }
            return String.valueOf(objectsTotal);
        }
    });
    add(objectsTotal);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) TaskCurrentStateDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskCurrentStateDto) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) Date(java.util.Date) IterativeTaskInformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.IterativeTaskInformationType)

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