Search in sources :

Example 1 with ProvisioningStatisticsEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType in project midpoint by Evolveum.

the class EnvironmentalPerformanceInformation method toProvisioningStatisticsType.

private ProvisioningStatisticsType toProvisioningStatisticsType() {
    ProvisioningStatisticsType rv = new ProvisioningStatisticsType();
    if (provisioningData == null) {
        return rv;
    }
    for (Map.Entry<ProvisioningStatisticsKey, ProvisioningStatisticsData> entry : provisioningData.entrySet()) {
        ProvisioningStatisticsKey key = entry.getKey();
        String resource = key.getResourceName();
        QName oc = key.getObjectClass();
        ProvisioningStatisticsEntryType entryType = findProvisioningEntryType(rv.getEntry(), resource, oc);
        if (entryType == null) {
            entryType = new ProvisioningStatisticsEntryType();
            entryType.setResource(resource);
            entryType.setObjectClass(oc);
            rv.getEntry().add(entryType);
        }
        setValue(entryType, key.getOperation(), key.getStatusType(), entry.getValue().getCount(), entry.getValue().getMinDuration(), entry.getValue().getMaxDuration(), entry.getValue().getTotalDuration());
    }
    return rv;
}
Also used : ProvisioningStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsType) QName(javax.xml.namespace.QName) ProvisioningStatisticsEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with ProvisioningStatisticsEntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType in project midpoint by Evolveum.

the class EnvironmentalPerformanceInformation method addProvisioningTo.

private static void addProvisioningTo(EnvironmentalPerformanceInformationType rv, ProvisioningStatisticsType delta) {
    if (delta == null) {
        return;
    }
    if (rv.getProvisioningStatistics() == null) {
        rv.setProvisioningStatistics(delta.clone());
        return;
    }
    ProvisioningStatisticsType rvPST = rv.getProvisioningStatistics();
    for (ProvisioningStatisticsEntryType de : delta.getEntry()) {
        String resource = de.getResource();
        QName oc = de.getObjectClass();
        ProvisioningStatisticsEntryType e = findProvisioningEntryType(rvPST.getEntry(), resource, oc);
        if (e == null) {
            e = new ProvisioningStatisticsEntryType();
            e.setResource(resource);
            e.setObjectClass(oc);
            rvPST.getEntry().add(e);
        }
        e.setGetSuccess(e.getGetSuccess() + de.getGetSuccess());
        e.setSearchSuccess(e.getSearchSuccess() + de.getSearchSuccess());
        e.setCreateSuccess(e.getCreateSuccess() + de.getCreateSuccess());
        e.setUpdateSuccess(e.getUpdateSuccess() + de.getUpdateSuccess());
        e.setDeleteSuccess(e.getDeleteSuccess() + de.getDeleteSuccess());
        e.setSyncSuccess(e.getSyncSuccess() + de.getSyncSuccess());
        e.setScriptSuccess(e.getScriptSuccess() + de.getScriptSuccess());
        e.setOtherSuccess(e.getOtherSuccess() + de.getOtherSuccess());
        e.setGetFailure(e.getGetFailure() + de.getGetFailure());
        e.setSearchFailure(e.getSearchFailure() + de.getSearchFailure());
        e.setCreateFailure(e.getCreateFailure() + de.getCreateFailure());
        e.setUpdateFailure(e.getUpdateFailure() + de.getUpdateFailure());
        e.setDeleteFailure(e.getDeleteFailure() + de.getDeleteFailure());
        e.setSyncFailure(e.getSyncFailure() + de.getSyncFailure());
        e.setScriptFailure(e.getScriptFailure() + de.getScriptFailure());
        e.setOtherFailure(e.getOtherFailure() + de.getOtherFailure());
        int totalCount = e.getGetSuccess() + e.getGetFailure() + e.getSearchSuccess() + e.getSearchFailure() + e.getCreateSuccess() + e.getCreateFailure() + e.getUpdateSuccess() + e.getUpdateFailure() + e.getDeleteSuccess() + e.getDeleteFailure() + e.getSyncSuccess() + e.getSyncFailure() + e.getScriptSuccess() + e.getScriptFailure() + e.getOtherSuccess() + e.getOtherFailure();
        e.setMinTime(min(e.getMinTime(), de.getMinTime()));
        e.setMaxTime(max(e.getMaxTime(), de.getMaxTime()));
        e.setTotalTime(e.getTotalTime() + de.getTotalTime());
        if (totalCount > 0) {
            e.setAverageTime(e.getTotalTime() / totalCount);
        } else {
            e.setAverageTime(null);
        }
    }
}
Also used : ProvisioningStatisticsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsType) QName(javax.xml.namespace.QName) ProvisioningStatisticsEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType)

Aggregations

ProvisioningStatisticsEntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType)2 ProvisioningStatisticsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsType)2 QName (javax.xml.namespace.QName)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1