Search in sources :

Example 1 with CRITERIA_ISSUE_TYPE

use of com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_ISSUE_TYPE 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);
}
Also used : TestItem(com.epam.ta.reportportal.entity.item.TestItem) Autowired(org.springframework.beans.factory.annotation.Autowired) ErrorType(com.epam.ta.reportportal.ws.model.ErrorType) Operator(org.jooq.Operator) Statistics(com.epam.ta.reportportal.entity.statistics.Statistics) CRITERIA_ISSUE_TYPE(com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_ISSUE_TYPE) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) Map(java.util.Map) CRITERIA_LAUNCH_ID(com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_LAUNCH_ID) Pageable(org.springframework.data.domain.Pageable) TestItemRepository(com.epam.ta.reportportal.dao.TestItemRepository) IssueTypeRepositoryCustom(com.epam.ta.reportportal.dao.IssueTypeRepositoryCustom) LaunchAccessValidator(com.epam.ta.reportportal.core.item.impl.LaunchAccessValidator) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Set(java.util.Set) Page(org.springframework.data.domain.Page) Collectors(java.util.stream.Collectors) Component(org.springframework.stereotype.Component) List(java.util.List) com.epam.ta.reportportal.commons.querygen(com.epam.ta.reportportal.commons.querygen) Stream(java.util.stream.Stream) CRITERIA_ISSUE_TYPE_ID(com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_ISSUE_TYPE_ID) Optional(java.util.Optional) DataProviderHandler(com.epam.ta.reportportal.core.item.impl.provider.DataProviderHandler) ControllerUtils(com.epam.ta.reportportal.util.ControllerUtils) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) List(java.util.List)

Aggregations

ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)1 com.epam.ta.reportportal.commons.querygen (com.epam.ta.reportportal.commons.querygen)1 CRITERIA_LAUNCH_ID (com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_LAUNCH_ID)1 CRITERIA_ISSUE_TYPE (com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_ISSUE_TYPE)1 CRITERIA_ISSUE_TYPE_ID (com.epam.ta.reportportal.commons.querygen.constant.TestItemCriteriaConstant.CRITERIA_ISSUE_TYPE_ID)1 LaunchAccessValidator (com.epam.ta.reportportal.core.item.impl.LaunchAccessValidator)1 DataProviderHandler (com.epam.ta.reportportal.core.item.impl.provider.DataProviderHandler)1 IssueTypeRepositoryCustom (com.epam.ta.reportportal.dao.IssueTypeRepositoryCustom)1 TestItemRepository (com.epam.ta.reportportal.dao.TestItemRepository)1 TestItem (com.epam.ta.reportportal.entity.item.TestItem)1 Statistics (com.epam.ta.reportportal.entity.statistics.Statistics)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 ControllerUtils (com.epam.ta.reportportal.util.ControllerUtils)1 ErrorType (com.epam.ta.reportportal.ws.model.ErrorType)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1