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);
}
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;
}
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;
}
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;
}
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);
}
Aggregations