use of com.thinkbiganalytics.rest.model.search.SearchResultImpl in project kylo by Teradata.
the class ModelUtils method toSearchResult.
/**
* Convert a spring-data Page to a SearchResult UI object
*/
public static SearchResult toSearchResult(Page page) {
SearchResult searchResult = new SearchResultImpl();
searchResult.setData(page.getContent());
searchResult.setRecordsTotal(page.getTotalElements());
searchResult.setRecordsFiltered(page.getTotalElements());
return searchResult;
}
use of com.thinkbiganalytics.rest.model.search.SearchResultImpl in project kylo by Teradata.
the class FeedHealthSummaryCache method getUserFeedHealth.
public SearchResult getUserFeedHealth(Long time, FeedSummaryFilter feedSummaryFilter, RoleSetExposingSecurityExpressionRoot userContext) {
SearchResult<com.thinkbiganalytics.jobrepo.query.model.FeedSummary> searchResult = new SearchResultImpl();
List<FeedHealth> feedSummaryHealth = null;
// get the entire list back and filter it for user access
List<? extends FeedSummary> list = getFeedSummaryList(time).stream().filter(filter(feedSummaryFilter, userContext)).collect(Collectors.toList());
feedSummaryHealth = list.stream().sorted(feedSummaryFilter.getSort() != null ? getComparator(feedSummaryFilter.getSort()) : byName).skip(feedSummaryFilter.getStart()).limit(feedSummaryFilter.getLimit() > 0 ? feedSummaryFilter.getLimit() : Integer.MAX_VALUE).map(f -> FeedModelTransform.feedHealth(f)).collect(Collectors.toList());
// Transform it to FeedSummary objects
FeedStatus feedStatus = FeedModelTransform.feedStatus(feedSummaryHealth);
Long total = new Long(list.size());
searchResult.setData(feedStatus.getFeedSummary());
searchResult.setRecordsTotal(total);
searchResult.setRecordsFiltered(total);
return searchResult;
}
use of com.thinkbiganalytics.rest.model.search.SearchResultImpl in project kylo by Teradata.
the class FeedModelTransform method toSearchResult.
/**
* Convert a spring-data Page to a SearchResult UI object
*/
public SearchResult toSearchResult(Page<UIFeed> page) {
SearchResult searchResult = new SearchResultImpl();
searchResult.setData(page.getContent());
searchResult.setRecordsTotal(page.getTotalElements());
searchResult.setRecordsFiltered(page.getTotalElements());
return searchResult;
}
Aggregations