@Override
    public ResultPage<ProcessorTaskSummary> findSummary(final ExpressionCriteria criteria) {
        final Condition condition = expressionMapper.apply(criteria.getExpression());
        final Collection<OrderField<?>> orderFields = JooqUtil.getOrderFields(FIELD_MAP, criteria);
        final PageRequest pageRequest = criteria.getPageRequest();
        final int offset = JooqUtil.getOffset(pageRequest);
        final int limit = JooqUtil.getLimit(pageRequest, true);
        final Result<Record6<String, String, String, Integer, Byte, Integer>> result =
                JooqUtil.contextResult(processorDbConnProvider, context -> context
                        .select(
                                PROCESSOR.TASK_TYPE,
                                PROCESSOR_FEED.NAME,
                                PROCESSOR.PIPELINE_UUID,
                                PROCESSOR_FILTER.PRIORITY,
                                PROCESSOR_TASK.STATUS,
                                COUNT
                        )
                        .from(PROCESSOR_TASK)
                        .leftOuterJoin(PROCESSOR_NODE).on(PROCESSOR_TASK.FK_PROCESSOR_NODE_ID.eq(PROCESSOR_NODE.ID))
                        .join(PROCESSOR_FEED).on(PROCESSOR_TASK.FK_PROCESSOR_FEED_ID.eq(PROCESSOR_FEED.ID))
                        .join(PROCESSOR_FILTER).on(PROCESSOR_TASK.FK_PROCESSOR_FILTER_ID.eq(PROCESSOR_FILTER.ID))
                        .join(PROCESSOR).on(PROCESSOR_FILTER.FK_PROCESSOR_ID.eq(PROCESSOR.ID))
                        .where(condition)
                        .groupBy(
                                PROCESSOR.TASK_TYPE,
                                PROCESSOR_FEED.NAME,
                                PROCESSOR.PIPELINE_UUID,
                                PROCESSOR_FILTER.PRIORITY,
                                PROCESSOR_TASK.STATUS)
                        .orderBy(orderFields)
                        .limit(offset, limit)
                        .fetch());

        final List<ProcessorTaskSummary> list = result.map(record -> {
            final ProcessorType processorType = ProcessorType.fromDisplayValue(record.get(PROCESSOR.TASK_TYPE));
            final String docType;
            if (ProcessorType.STREAMING_ANALYTIC.equals(processorType)) {
                docType = AnalyticRuleDoc.TYPE;
            } else {
                docType = PipelineDoc.TYPE;
            }

            final String feed = record.get(PROCESSOR_FEED.NAME);
            final String pipelineUuid = record.get(PROCESSOR.PIPELINE_UUID);
            final int priority = record.get(PROCESSOR_FILTER.PRIORITY);
            final TaskStatus status = TaskStatus.PRIMITIVE_VALUE_CONVERTER.fromPrimitiveValue(record.get(
                    PROCESSOR_TASK.STATUS));
            final int count = record.get(COUNT);
            DocRef pipelineDocRef = new DocRef(docType, pipelineUuid);
            final Optional<String> pipelineName = docRefInfoService.name(pipelineDocRef);
            if (pipelineName.isPresent()) {
                pipelineDocRef = pipelineDocRef.copy().name(pipelineName.get()).build();
            }
            return new ProcessorTaskSummary(pipelineDocRef, feed, priority, status, count);
        });

        return ResultPage.createCriterialBasedList(list, criteria);
    }
Count the current number of tasks for a filter matching the specified status.

@param filterId The filter to count tasks for.
@param status   Task status.
@return The number of tasks matching the specified status.
stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorTaskDaoImpl.java