use of com.epam.ta.reportportal.core.item.impl.history.param.HistoryRequestParams in project service-api by reportportal.
the class TestItemsHistoryHandlerImpl method getItemsHistory.
@Override
public Iterable<TestItemHistoryElement> getItemsHistory(ReportPortalUser.ProjectDetails projectDetails, Queryable filter, Pageable pageable, HistoryRequestParams historyRequestParams, ReportPortalUser user) {
validateHistoryDepth(historyRequestParams.getHistoryDepth());
CompositeFilter itemHistoryFilter = new CompositeFilter(Operator.AND, filter, Filter.builder().withTarget(filter.getTarget().getClazz()).withCondition(FilterCondition.builder().eq(CRITERIA_PROJECT_ID, String.valueOf(projectDetails.getProjectId())).build()).withCondition(FilterCondition.builder().eq(CRITERIA_LAUNCH_MODE, LaunchModeEnum.DEFAULT.name()).build()).withCondition(FilterCondition.builder().eq(CRITERIA_HAS_STATS, String.valueOf(Boolean.TRUE)).build()).build());
Page<TestItemHistory> testItemHistoryPage = historyProviderFactory.getProvider(historyRequestParams).orElseThrow(() -> new ReportPortalException(UNABLE_LOAD_TEST_ITEM_HISTORY, "Unable to find suitable history baseline provider")).provide(itemHistoryFilter, pageable, historyRequestParams, projectDetails, user, !oldHistory);
return buildHistoryElements(oldHistory ? TestItemResource::getUniqueId : testItemResource -> String.valueOf(testItemResource.getTestCaseHash()), testItemHistoryPage, projectDetails.getProjectId(), pageable);
}
use of com.epam.ta.reportportal.core.item.impl.history.param.HistoryRequestParams in project service-api by reportportal.
the class TestItemBaselineHistoryProvider method loadHistory.
private Page<TestItemHistory> loadHistory(Queryable filter, Pageable pageable, Long itemId, HistoryRequestParams historyRequestParams, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user, boolean usingHash) {
TestItem testItem = testItemRepository.findById(itemId).orElseThrow(() -> new ReportPortalException(ErrorType.TEST_ITEM_NOT_FOUND, itemId));
Launch launch = testItemService.getEffectiveLaunch(testItem);
launchAccessValidator.validate(launch.getId(), projectDetails, user);
return historyRequestParams.getHistoryType().filter(HistoryRequestParams.HistoryTypeEnum.LINE::equals).map(type -> testItemRepository.loadItemsHistoryPage(filter, pageable, projectDetails.getProjectId(), launch.getName(), historyRequestParams.getHistoryDepth(), usingHash)).orElseGet(() -> testItemRepository.loadItemsHistoryPage(filter, pageable, projectDetails.getProjectId(), historyRequestParams.getHistoryDepth(), usingHash));
}
Aggregations