Search in sources :

Example 1 with ErrataCount

use of org.ovirt.engine.core.common.businessentities.ErrataCount in project ovirt-engine by oVirt.

the class KatelloProvider method addErrataCountForType.

private void addErrataCountForType(ErrataData errataData, Erratum.ErrataType errataType) {
    Stream<Erratum> typedErrata = errataData.getErrata().stream().filter(erratum -> erratum.getType() == errataType);
    long totalCount = typedErrata.count();
    if (totalCount > 0) {
        Map<Erratum.ErrataSeverity, Long> errataBySeverity = errataData.getErrata().stream().collect(Collectors.groupingBy(Erratum::getSeverityOrDefault, Collectors.counting()));
        ErrataCount errataCount = new ErrataCount();
        errataCount.setTotalCount((int) totalCount);
        errataBySeverity.entrySet().forEach(entry -> errataCount.getCountBySeverity().put(entry.getKey(), entry.getValue().intValue()));
        errataData.getErrataCounts().getErrataCountByType().put(errataType, errataCount);
    }
}
Also used : ErrataCount(org.ovirt.engine.core.common.businessentities.ErrataCount) Erratum(org.ovirt.engine.core.common.businessentities.Erratum)

Aggregations

ErrataCount (org.ovirt.engine.core.common.businessentities.ErrataCount)1 Erratum (org.ovirt.engine.core.common.businessentities.Erratum)1