Search in sources :

Example 1 with SearchResultImpl

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;
}
Also used : SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult)

Example 2 with SearchResultImpl

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;
}
Also used : SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) FeedStatus(com.thinkbiganalytics.jobrepo.query.model.FeedStatus) FeedHealth(com.thinkbiganalytics.jobrepo.query.model.FeedHealth) JpaFeedSummary(com.thinkbiganalytics.metadata.jpa.feed.JpaFeedSummary) FeedSummary(com.thinkbiganalytics.metadata.api.feed.FeedSummary)

Example 3 with SearchResultImpl

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;
}
Also used : SearchResultImpl(com.thinkbiganalytics.rest.model.search.SearchResultImpl) SearchResult(com.thinkbiganalytics.rest.model.search.SearchResult)

Aggregations

SearchResultImpl (com.thinkbiganalytics.rest.model.search.SearchResultImpl)3 SearchResult (com.thinkbiganalytics.rest.model.search.SearchResult)2 FeedHealth (com.thinkbiganalytics.jobrepo.query.model.FeedHealth)1 FeedStatus (com.thinkbiganalytics.jobrepo.query.model.FeedStatus)1 FeedSummary (com.thinkbiganalytics.metadata.api.feed.FeedSummary)1 JpaFeedSummary (com.thinkbiganalytics.metadata.jpa.feed.JpaFeedSummary)1