use of com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType in project midpoint by Evolveum.
the class NotificationsLineDto method extractFromOperationalInformation.
public static List<NotificationsLineDto> extractFromOperationalInformation(EnvironmentalPerformanceInformation environmentalPerformanceInformation) {
EnvironmentalPerformanceInformationType environmentalPerformanceInformationType = environmentalPerformanceInformation.getAggregatedValue();
NotificationsStatisticsType notificationsStatisticsType = environmentalPerformanceInformationType.getNotificationsStatistics();
return extractFromOperationalInformation(notificationsStatisticsType);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType in project midpoint by Evolveum.
the class EnvironmentalPerformanceInformation method toNotificationsStatisticsType.
private NotificationsStatisticsType toNotificationsStatisticsType() {
NotificationsStatisticsType rv = new NotificationsStatisticsType();
if (notificationsData == null) {
return rv;
}
for (Map.Entry<NotificationsStatisticsKey, GenericStatisticsData> entry : notificationsData.entrySet()) {
NotificationsStatisticsKey key = entry.getKey();
String transport = key.getTransport();
NotificationsStatisticsEntryType entryType = findNotificationsEntryType(rv.getEntry(), transport);
if (entryType == null) {
entryType = new NotificationsStatisticsEntryType();
entryType.setTransport(transport);
rv.getEntry().add(entryType);
}
setValueNotifications(entryType, key.isSuccess(), entry.getValue().getCount(), entry.getValue().getMinDuration(), entry.getValue().getMaxDuration(), entry.getValue().getTotalDuration());
}
return rv;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType 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