Search in sources :

Example 1 with NotificationsStatisticsEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType 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;
}
Also used : NotificationsStatisticsEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType) NotificationsStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with NotificationsStatisticsEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType 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);
        }
    }
}
Also used : NotificationsStatisticsEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType) NotificationsStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType)

Aggregations

NotificationsStatisticsEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType)2 NotificationsStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1