Search in sources :

Example 1 with FeedStatus

use of com.thinkbiganalytics.jobrepo.query.model.FeedStatus 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 2 with FeedStatus

use of com.thinkbiganalytics.jobrepo.query.model.FeedStatus in project kylo by Teradata.

the class FeedsRestController method getFeedHealth.

@GET
@Path("/health")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Provides a detailed health status of every feed.")
@ApiResponses(@ApiResponse(code = 200, message = "Returns the health.", response = FeedStatus.class))
public FeedStatus getFeedHealth(@Context HttpServletRequest request) {
    this.accessController.checkPermission(AccessController.SERVICES, OperationsAccessControl.ACCESS_OPS);
    return metadataAccess.read(() -> {
        List<FeedHealth> feedHealth = getFeedHealthCounts(request);
        FeedStatus status = FeedModelTransform.feedStatus(feedHealth);
        return status;
    });
}
Also used : FeedStatus(com.thinkbiganalytics.jobrepo.query.model.FeedStatus) FeedHealth(com.thinkbiganalytics.jobrepo.query.model.FeedHealth) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

FeedHealth (com.thinkbiganalytics.jobrepo.query.model.FeedHealth)2 FeedStatus (com.thinkbiganalytics.jobrepo.query.model.FeedStatus)2 FeedSummary (com.thinkbiganalytics.metadata.api.feed.FeedSummary)1 JpaFeedSummary (com.thinkbiganalytics.metadata.jpa.feed.JpaFeedSummary)1 SearchResultImpl (com.thinkbiganalytics.rest.model.search.SearchResultImpl)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1