Search in sources :

Example 11 with EnvironmentalPerformanceInformationType

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

EnvironmentalPerformanceInformationType (com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType)8 MappingsStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsType)2 NotificationsStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType)2 OperationStatsType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationStatsType)2 ProvisioningStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsType)2 MappingsStatisticsEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType)1 NotificationsStatisticsEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType)1 ProvisioningStatisticsEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType)1 QName (javax.xml.namespace.QName)1