use of com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType in project midpoint by Evolveum.
the class EnvironmentalPerformanceInformation method addNotificationsTo.
private static void addNotificationsTo(EnvironmentalPerformanceInformationType rv, NotificationsStatisticsType delta) {
if (delta == null) {
return;
}
if (rv.getNotificationsStatistics() == null) {
rv.setNotificationsStatistics(delta.clone());
return;
}
NotificationsStatisticsType rvNST = rv.getNotificationsStatistics();
for (NotificationsStatisticsEntryType de : delta.getEntry()) {
String transport = de.getTransport();
NotificationsStatisticsEntryType e = findNotificationsEntryType(rvNST.getEntry(), transport);
if (e == null) {
e = new NotificationsStatisticsEntryType();
e.setTransport(transport);
rvNST.getEntry().add(e);
}
e.setCountSuccess(e.getCountSuccess() + de.getCountSuccess());
e.setCountFailure(e.getCountFailure() + de.getCountFailure());
int count = e.getCountSuccess() + e.getCountFailure();
e.setMinTime(min(e.getMinTime(), de.getMinTime()));
e.setMaxTime(max(e.getMaxTime(), de.getMaxTime()));
e.setTotalTime(e.getTotalTime() + de.getTotalTime());
if (count > 0) {
e.setAverageTime(e.getTotalTime() / count);
} else {
e.setAverageTime(null);
}
}
}
Aggregations