use of com.synopsys.integration.alert.database.distribution.DistributionRepository.DistributionDBResponse in project hub-alert by blackducksoftware.
the class DefaultDistributionAccessor method retrieveData.
private AlertPagedModel<DistributionWithAuditInfo> retrieveData(int page, int pageSize, String sortName, Direction sortOrder, Function<PageRequest, Page<DistributionDBResponse>> retrieveData) {
Sort sort = (sortName == null || sortOrder == null) ? Sort.unsorted() : Sort.by(sortOrder, sortName);
PageRequest pageRequest = PageRequest.of(page, pageSize, sort);
Page<DistributionDBResponse> pageOfResponses = retrieveData.apply(pageRequest);
List<DistributionWithAuditInfo> distributionWithAuditInfos = pageOfResponses.get().map(this::convert).collect(Collectors.toList());
return new AlertPagedModel<>(pageOfResponses.getTotalPages(), pageOfResponses.getNumber(), pageOfResponses.getSize(), distributionWithAuditInfos);
}
Aggregations