use of com.evolveum.midpoint.xml.ns._public.common.common_3.IterativeTaskInformationType in project midpoint by Evolveum.
the class IterativeTaskInformation method aggregate.
private IterativeTaskInformationType aggregate(IterativeTaskInformationType startValue, IterativeTaskInformationType delta) {
if (startValue == null) {
return delta;
}
IterativeTaskInformationType rv = new IterativeTaskInformationType();
addTo(rv, startValue, true);
addTo(rv, delta, true);
return rv;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.IterativeTaskInformationType 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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.IterativeTaskInformationType in project midpoint by Evolveum.
the class IterativeTaskInformation method getAggregatedValue.
public synchronized IterativeTaskInformationType getAggregatedValue() {
IterativeTaskInformationType delta = toIterativeTaskInformationType();
IterativeTaskInformationType rv = aggregate(startValue, delta);
return rv;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.IterativeTaskInformationType in project midpoint by Evolveum.
the class IterativeTaskInformation method toIterativeTaskInformationType.
private IterativeTaskInformationType toIterativeTaskInformationType() {
IterativeTaskInformationType rv = new IterativeTaskInformationType();
toJaxb(rv);
return rv;
}
Aggregations