use of com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants.TIMELINE in project service-api by reportportal.
the class LineChartContentLoader 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 = GROUP_SORTS.apply(filterSortMapping.values());
List<ChartStatisticsContent> content = widgetContentRepository.launchStatistics(filter, contentFields, sort, limit);
String timeLineOption = ofNullable(widgetOptions).map(wo -> WidgetOptionUtil.getValueByKey(TIMELINE, wo)).orElse(Strings.EMPTY);
if (StringUtils.isNotBlank(timeLineOption)) {
Optional<Period> period = Period.findByName(timeLineOption);
if (period.isPresent()) {
return CollectionUtils.isEmpty(content) ? emptyMap() : singletonMap(RESULT, groupByDate(content, period.get()));
}
}
return CollectionUtils.isEmpty(content) ? emptyMap() : singletonMap(RESULT, content);
}
Aggregations