Search in sources :

Example 1 with HealthCheckTableContent

use of com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent in project commons-dao by reportportal.

the class HealthCheckTableChain method concat.

private List<HealthCheckTableContent> concat(boolean contentFirst, Map<String, HealthCheckTableStatisticsContent> content, Map<String, List<String>> columnMapping) {
    List<HealthCheckTableContent> result = Lists.newArrayListWithExpectedSize(content.size());
    if (contentFirst) {
        content.forEach((key, statistics) -> {
            HealthCheckTableContent resultEntry = entryFromStatistics(key, statistics);
            ofNullable(columnMapping.get(key)).ifPresent(resultEntry::setCustomValues);
            result.add(resultEntry);
        });
    } else {
        columnMapping.forEach((key, attributes) -> {
            HealthCheckTableContent resultEntry = ofNullable(content.remove(key)).map(statisticsContent -> entryFromStatistics(key, statisticsContent)).orElseGet(HealthCheckTableContent::new);
            resultEntry.setCustomValues(attributes);
            result.add(resultEntry);
        });
        content.forEach((key, statistics) -> result.add(entryFromStatistics(key, statistics)));
    }
    return result;
}
Also used : Component(org.springframework.stereotype.Component) java.util(java.util) Collectors.toList(java.util.stream.Collectors.toList) Lists(com.google.common.collect.Lists) HealthCheckTableContent(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent) HealthCheckTableGetParams(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableGetParams) Optional.ofNullable(java.util.Optional.ofNullable) WidgetProviderChain(com.epam.ta.reportportal.dao.widget.WidgetProviderChain) Autowired(org.springframework.beans.factory.annotation.Autowired) HealthCheckTableStatisticsContent(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableStatisticsContent) Sets(com.google.common.collect.Sets) PASSING_RATE(com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.PASSING_RATE) HealthCheckTableContent(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent)

Example 2 with HealthCheckTableContent

use of com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent in project commons-dao by reportportal.

the class HealthCheckTableChain method entryFromStatistics.

private HealthCheckTableContent entryFromStatistics(String key, HealthCheckTableStatisticsContent statisticsContent) {
    HealthCheckTableContent resultEntry = new HealthCheckTableContent();
    resultEntry.setAttributeValue(key);
    resultEntry.setPassingRate(statisticsContent.getPassingRate());
    resultEntry.setStatistics(statisticsContent.getStatistics());
    return resultEntry;
}
Also used : HealthCheckTableContent(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent)

Aggregations

HealthCheckTableContent (com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent)2 PASSING_RATE (com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.PASSING_RATE)1 WidgetProviderChain (com.epam.ta.reportportal.dao.widget.WidgetProviderChain)1 HealthCheckTableGetParams (com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableGetParams)1 HealthCheckTableStatisticsContent (com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableStatisticsContent)1 Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 java.util (java.util)1 Optional.ofNullable (java.util.Optional.ofNullable)1 Collectors.toList (java.util.stream.Collectors.toList)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Component (org.springframework.stereotype.Component)1