Search in sources :

Example 1 with CRITERIA_NAME

use of com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME in project service-api by reportportal.

the class MostTimeConsumingContentLoader method loadContent.

@Override
public Map<String, ?> loadContent(List<String> contentFields, Map<Filter, Sort> filterSortMap, WidgetOptions widgetOptions, int limit) {
    Filter filter = GROUP_FILTERS.apply(filterSortMap.keySet());
    String launchName = WidgetOptionUtil.getValueByKey(LAUNCH_NAME_FIELD, widgetOptions);
    return launchRepository.findLatestByFilter(filter.withCondition(FilterCondition.builder().eq(CRITERIA_NAME, launchName).build())).map(l -> loadContent(l, widgetOptions, contentFields)).orElseGet(Collections::emptyMap);
}
Also used : TestItemTypeEnum(com.epam.ta.reportportal.entity.enums.TestItemTypeEnum) StatusEnum(com.epam.ta.reportportal.entity.enums.StatusEnum) WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) TestItem(com.epam.ta.reportportal.entity.item.TestItem) ContentLoaderConstants(com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants) Autowired(org.springframework.beans.factory.annotation.Autowired) GROUP_FILTERS(com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_FILTERS) BooleanUtils(org.apache.commons.lang3.BooleanUtils) TestItemCriteriaConstant(com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant) MostTimeConsumingTestCasesContent(com.epam.ta.reportportal.entity.widget.content.MostTimeConsumingTestCasesContent) StringUtils(org.apache.commons.lang3.StringUtils) Lists(com.google.common.collect.Lists) CollectionUtils(org.apache.commons.collections.CollectionUtils) Service(org.springframework.stereotype.Service) Condition(com.epam.ta.reportportal.commons.querygen.Condition) Map(java.util.Map) CRITERIA_LAUNCH_ID(com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_LAUNCH_ID) CRITERIA_NAME(com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME) Sort(org.springframework.data.domain.Sort) Collections.emptyMap(java.util.Collections.emptyMap) Launch(com.epam.ta.reportportal.entity.launch.Launch) ImmutableMap(com.google.common.collect.ImmutableMap) Optional.ofNullable(java.util.Optional.ofNullable) Filter(com.epam.ta.reportportal.commons.querygen.Filter) WidgetOptionUtil(com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) WidgetContentRepository(com.epam.ta.reportportal.dao.WidgetContentRepository) Collectors(java.util.stream.Collectors) List(java.util.List) HAS_METHOD_OR_CLASS(com.epam.ta.reportportal.core.filter.predefined.PredefinedFilters.HAS_METHOD_OR_CLASS) LoadContentStrategy(com.epam.ta.reportportal.core.widget.content.LoadContentStrategy) LaunchRepository(com.epam.ta.reportportal.dao.LaunchRepository) LatestLaunchContent(com.epam.ta.reportportal.entity.widget.content.LatestLaunchContent) STEP(com.epam.ta.reportportal.jooq.enums.JTestItemTypeEnum.STEP) Collections(java.util.Collections) Filter(com.epam.ta.reportportal.commons.querygen.Filter) Collections(java.util.Collections)

Example 2 with CRITERIA_NAME

use of com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME in project service-api by reportportal.

the class FlakyCasesTableContentLoader 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());
    String launchName = WidgetOptionUtil.getValueByKey(LAUNCH_NAME_FIELD, widgetOptions);
    filter.withCondition(new FilterCondition(Condition.EQUALS, false, launchName, CRITERIA_NAME));
    return launchRepository.findLatestByFilter(filter).map(l -> loadContent(l, filter, widgetOptions, limit)).orElseGet(Collections::emptyMap);
}
Also used : WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) ContentLoaderConstants(com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants) Autowired(org.springframework.beans.factory.annotation.Autowired) GROUP_FILTERS(com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_FILTERS) BooleanUtils(org.apache.commons.lang3.BooleanUtils) CollectionUtils(org.apache.commons.collections.CollectionUtils) Service(org.springframework.stereotype.Service) Condition(com.epam.ta.reportportal.commons.querygen.Condition) Map(java.util.Map) CRITERIA_NAME(com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME) Sort(org.springframework.data.domain.Sort) FlakyCasesTableContent(com.epam.ta.reportportal.entity.widget.content.FlakyCasesTableContent) Collections.emptyMap(java.util.Collections.emptyMap) Launch(com.epam.ta.reportportal.entity.launch.Launch) ImmutableMap(com.google.common.collect.ImmutableMap) Optional.ofNullable(java.util.Optional.ofNullable) Filter(com.epam.ta.reportportal.commons.querygen.Filter) WidgetOptionUtil(com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) WidgetContentRepository(com.epam.ta.reportportal.dao.WidgetContentRepository) List(java.util.List) LoadContentStrategy(com.epam.ta.reportportal.core.widget.content.LoadContentStrategy) LaunchRepository(com.epam.ta.reportportal.dao.LaunchRepository) LatestLaunchContent(com.epam.ta.reportportal.entity.widget.content.LatestLaunchContent) Collections(java.util.Collections) Filter(com.epam.ta.reportportal.commons.querygen.Filter) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) Collections(java.util.Collections)

Example 3 with CRITERIA_NAME

use of com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME in project service-api by reportportal.

the class TopTestCasesContentLoader method loadContent.

@Override
public Map<String, ?> loadContent(List<String> contentFields, Map<Filter, Sort> filterSortMapping, WidgetOptions widgetOptions, int limit) {
    String criteria = contentFields.get(0);
    Filter filter = GROUP_FILTERS.apply(filterSortMapping.keySet()).withCondition(new FilterCondition(Condition.EQUALS, false, WidgetOptionUtil.getValueByKey(LAUNCH_NAME_FIELD, widgetOptions), CRITERIA_NAME));
    return launchRepository.findLatestByFilter(filter).map(it -> Pair.of(it, widgetContentRepository.topItemsByCriteria(filter, criteria, limit, ofNullable(widgetOptions.getOptions().get(INCLUDE_METHODS)).map(v -> BooleanUtils.toBoolean(String.valueOf(v))).orElse(false)))).filter(it -> !it.getRight().isEmpty()).map(it -> (Map<String, ?>) ImmutableMap.<String, Object>builder().put(LATEST_LAUNCH, launchConverter.TO_RESOURCE.apply(it.getLeft())).put(RESULT, it.getRight()).build()).orElse(Collections.emptyMap());
}
Also used : WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) ImmutableMap(com.google.common.collect.ImmutableMap) Optional.ofNullable(java.util.Optional.ofNullable) Filter(com.epam.ta.reportportal.commons.querygen.Filter) ContentLoaderConstants(com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants) WidgetOptionUtil(com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil) Autowired(org.springframework.beans.factory.annotation.Autowired) GROUP_FILTERS(com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_FILTERS) BooleanUtils(org.apache.commons.lang3.BooleanUtils) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) WidgetContentRepository(com.epam.ta.reportportal.dao.WidgetContentRepository) List(java.util.List) LoadContentStrategy(com.epam.ta.reportportal.core.widget.content.LoadContentStrategy) Pair(org.apache.commons.lang3.tuple.Pair) LaunchRepository(com.epam.ta.reportportal.dao.LaunchRepository) Service(org.springframework.stereotype.Service) Condition(com.epam.ta.reportportal.commons.querygen.Condition) Map(java.util.Map) LaunchConverter(com.epam.ta.reportportal.ws.converter.converters.LaunchConverter) CRITERIA_NAME(com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME) Sort(org.springframework.data.domain.Sort) Collections(java.util.Collections) Filter(com.epam.ta.reportportal.commons.querygen.Filter) FilterCondition(com.epam.ta.reportportal.commons.querygen.FilterCondition) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map)

Aggregations

Condition (com.epam.ta.reportportal.commons.querygen.Condition)3 Filter (com.epam.ta.reportportal.commons.querygen.Filter)3 FilterCondition (com.epam.ta.reportportal.commons.querygen.FilterCondition)3 CRITERIA_NAME (com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_NAME)3 LoadContentStrategy (com.epam.ta.reportportal.core.widget.content.LoadContentStrategy)3 ContentLoaderConstants (com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants)3 GROUP_FILTERS (com.epam.ta.reportportal.core.widget.util.WidgetFilterUtil.GROUP_FILTERS)3 WidgetOptionUtil (com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil)3 LaunchRepository (com.epam.ta.reportportal.dao.LaunchRepository)3 WidgetContentRepository (com.epam.ta.reportportal.dao.WidgetContentRepository)3 WidgetOptions (com.epam.ta.reportportal.entity.widget.WidgetOptions)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 Collections (java.util.Collections)3 List (java.util.List)3 Map (java.util.Map)3 Optional.ofNullable (java.util.Optional.ofNullable)3 BooleanUtils (org.apache.commons.lang3.BooleanUtils)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Sort (org.springframework.data.domain.Sort)3 Service (org.springframework.stereotype.Service)3