@@ -0,0 +1,2546 @@
+/*%0A * Copyright 2017 EPAM Systems%0A *%0A *%0A * This file is part of EPAM Report Portal.%0A * https://github.com/reportportal/service-api%0A *%0A * Report Portal is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * Report Portal is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with Report Portal.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage com.epam.ta.reportportal.core.widget.content.loader;%0A%0Aimport com.epam.ta.reportportal.commons.querygen.Filter;%0Aimport com.epam.ta.reportportal.core.widget.content.LoadContentStrategy;%0Aimport com.epam.ta.reportportal.dao.WidgetContentRepository;%0Aimport com.epam.ta.reportportal.entity.launch.Launch;%0Aimport com.epam.ta.reportportal.entity.widget.WidgetOption;%0Aimport com.epam.ta.reportportal.entity.widget.content.StatisticsContent;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Service;%0A%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Set;%0Aimport java.util.function.Function;%0Aimport java.util.stream.Collectors;%0A%0Aimport static com.epam.ta.reportportal.core.widget.content.WidgetContentUtils.GROUP_CONTENT_FIELDS;%0A%0A/**%0A * @author Pavel Bortnik%0A */%0A@Service%0Apublic class OverallStatisticsContentLoader implements LoadContentStrategy %7B%0A%0A%09@Autowired%0A%09private WidgetContentRepository widgetContentRepository;%0A%0A%09@Override%0A%09public Map%3CString, ?%3E loadContent(List%3CString%3E contentFields, Set%3CFilter%3E filters, Set%3CWidgetOption%3E widgetOptions) %7B%0A%09%09boolean latestMode = widgetOptions.stream().anyMatch(it -%3E it.getWidgetOption().equalsIgnoreCase(LATEST_OPTION));%0A%09%09List%3CStatisticsContent%3E content = widgetContentRepository.overallStatisticsContent(%0A%09%09%09%09COMBINE_FILTERS.apply(filters), GROUP_CONTENT_FIELDS.apply(contentFields), latestMode);%0A%09%09Map%3CString, List%3CStatisticsContent%3E%3E result = new HashMap%3C%3E();%0A%09%09result.put(RESULT, content);%0A%09%09return result;%0A%09%7D%0A%0A%09private static final Function%3CSet%3CFilter%3E, Filter%3E COMBINE_FILTERS = filters -%3E new Filter(%0A%09%09%09Launch.class, filters.stream().flatMap(it -%3E it.getFilterConditions().stream()).collect(Collectors.toSet()));%0A%7D%0A

return back content loader