use of com.epam.ta.reportportal.core.item.impl.provider.DataProviderType in project service-api by reportportal.
the class GetTestItemHandlerImpl method getTestItemsByProvider.
@Override
public Iterable<TestItemResource> getTestItemsByProvider(Queryable filter, Pageable pageable, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user, Map<String, String> params) {
DataProviderType dataProviderType = DataProviderType.findByName(params.get(PROVIDER_TYPE_PARAM)).orElseThrow(() -> new ReportPortalException(ErrorType.BAD_REQUEST_ERROR, "Test item data provider base is not specified. Allowed data provider {}", DataProviderType.values()));
Page<TestItem> testItemPage = testItemDataProviders.get(dataProviderType).getTestItems(filter, pageable, projectDetails, user, params);
return PagedResourcesAssembler.<TestItem, TestItemResource>pageMultiConverter(items -> {
List<ResourceUpdater<TestItemResource>> resourceUpdaters = getResourceUpdaters(projectDetails.getProjectId(), testItemPage.getContent());
return items.stream().map(item -> {
TestItemResource testItemResource = TestItemConverter.TO_RESOURCE.apply(item);
resourceUpdaters.forEach(updater -> updater.updateResource(testItemResource));
return testItemResource;
}).collect(toList());
}).apply(testItemPage);
}
Aggregations