use of com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_LAUNCH_ID in project service-api by reportportal.
the class LaunchDataProviderHandlerImpl method updateFilter.
private Queryable updateFilter(Queryable filter, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user, Map<String, String> params) {
Long launchId = Optional.ofNullable(params.get(LAUNCH_ID_PARAM)).map(ControllerUtils::safeParseLong).orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Launch id must be provided for launch based items provider"));
launchAccessValidator.validate(launchId, projectDetails, user);
Queryable launchBasedFilter = Filter.builder().withTarget(TestItem.class).withCondition(FilterCondition.builder().eq(CRITERIA_LAUNCH_ID, String.valueOf(launchId)).build()).build();
// Added to fix performance issue.
List<String> issueTypeLocators = filter.getFilterConditions().stream().map(ConvertibleCondition::getAllConditions).flatMap(List::stream).filter(c -> CRITERIA_ISSUE_TYPE.equals(c.getSearchCriteria()) && !c.isNegative() && Condition.IN.equals(c.getCondition())).map(FilterCondition::getValue).flatMap(c -> Stream.of(c.split(","))).collect(Collectors.toList());
String issueTypeIdsString = issueTypeRepository.getIssueTypeIdsByLocators(issueTypeLocators).stream().map(String::valueOf).collect(Collectors.joining(","));
FilterCondition oldIssueTypeCondition = new FilterCondition(Condition.IN, false, null, CRITERIA_ISSUE_TYPE);
FilterCondition issueTypeIdCondition = new FilterCondition(Condition.IN, false, issueTypeIdsString, CRITERIA_ISSUE_TYPE_ID);
filter.replaceSearchCriteria(oldIssueTypeCondition, issueTypeIdCondition);
return new CompositeFilter(Operator.AND, filter, launchBasedFilter);
}
use of com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_LAUNCH_ID in project service-api by reportportal.
the class MostTimeConsumingContentLoader method buildItemFilter.
private Filter buildItemFilter(Long launchId, WidgetOptions widgetOptions, List<String> contentFields) {
Filter filter = Filter.builder().withTarget(TestItem.class).withCondition(FilterCondition.builder().eq(CRITERIA_LAUNCH_ID, String.valueOf(launchId)).build()).build();
filter = updateFilterWithStatuses(filter, contentFields);
filter = updateFilterWithTestItemTypes(filter, ofNullable(widgetOptions.getOptions().get(INCLUDE_METHODS)).map(v -> BooleanUtils.toBoolean(String.valueOf(v))).orElse(false));
return filter.withCondition(FilterCondition.builder().eq(CRITERIA_HAS_CHILDREN, Boolean.FALSE.toString()).build()).withCondition(FilterCondition.builder().eq(CRITERIA_HAS_STATS, Boolean.TRUE.toString()).build());
}
Aggregations