Search in sources :

Example 11 with ChartStatisticsContent

use of com.epam.ta.reportportal.entity.widget.content.ChartStatisticsContent in project service-api by reportportal.

the class LaunchesComparisonContentLoader method loadContent.

@Override
public Map<String, ?> loadContent(List<String> contentFields, Map<Filter, Sort> filterSortMapping, WidgetOptions widgetOptions, int limit) {
    Filter filter = GROUP_FILTERS.apply(filterSortMapping.keySet());
    Sort sort = Sort.by(Sort.Order.desc(CRITERIA_START_TIME), Sort.Order.desc(CRITERIA_LAUNCH_NUMBER));
    List<ChartStatisticsContent> result = widgetContentRepository.launchesComparisonStatistics(filter, contentFields, sort, limit);
    if (result.isEmpty()) {
        return emptyMap();
    } else {
        Collections.reverse(result);
        return singletonMap(RESULT, result);
    }
}
Also used : Filter(com.epam.ta.reportportal.commons.querygen.Filter) Sort(org.springframework.data.domain.Sort) ChartStatisticsContent(com.epam.ta.reportportal.entity.widget.content.ChartStatisticsContent)

Aggregations

ChartStatisticsContent (com.epam.ta.reportportal.entity.widget.content.ChartStatisticsContent)11 Filter (com.epam.ta.reportportal.commons.querygen.Filter)6 Sort (org.springframework.data.domain.Sort)6 Optional.ofNullable (java.util.Optional.ofNullable)4 java.util (java.util)3 BinaryOperator (java.util.function.BinaryOperator)3 Function (java.util.function.Function)3 Collectors (java.util.stream.Collectors)3 DATE_PATTERN (net.sf.jasperreports.types.date.FixedDate.DATE_PATTERN)3 MapUtils (org.apache.commons.collections.MapUtils)3 DateTime (org.joda.time.DateTime)3 LoadContentStrategy (com.epam.ta.reportportal.core.widget.content.LoadContentStrategy)1 RESULT (com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants.RESULT)1 TIMELINE (com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants.TIMELINE)1 GROUP_FILTERS (com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_FILTERS)1 GROUP_SORTS (com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_SORTS)1 WidgetOptionUtil (com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil)1 WidgetContentRepository (com.epam.ta.reportportal.dao.WidgetContentRepository)1 WidgetOptions (com.epam.ta.reportportal.entity.widget.WidgetOptions)1 ArrayList (java.util.ArrayList)1