class AggregatingJobServiceGateway implements JobServiceGateway {

    @Override
    public Observable<JobQueryResult> findJobs(JobQuery request, CallMetadata callMetadata) {
        if (request.getPage().getPageSize() <= 0) {
            return Observable.just(JobQueryResult.newBuilder()
                    .setPagination(emptyGrpcPagination(request.getPage()))
                    .build());
        }

        Set<String> fieldsFilter = Collections.emptySet();
        if (request.getFieldsCount() > 0) {
            fieldsFilter = new HashSet<>(request.getFieldsList());
            fieldsFilter.addAll(JOB_MINIMUM_FIELD_SET);
            request = request.toBuilder()
                    .addAllFields(fieldsFilter)
                    .addAllFields(JOB_FEDERATION_MINIMUM_FIELD_SET)
                    .build();
        }

        if (StringExt.isNotEmpty(request.getPage().getCursor()) || request.getPage().getPageNumber() == 0) {
            return findJobsWithCursorPagination(request, fieldsFilter, callMetadata);
        }
        // TODO: page number pagination
        return Observable.error(TitusServiceException.invalidArgument("pageNumbers are not supported, please use cursors"));
    }

    @Inject public  AggregatingJobServiceGateway(GrpcConfiguration grpcConfiguration,
                                        TitusFederationConfiguration federationConfiguration,
                                        CellConnector connector,
                                        CellRouter router,
                                        AggregatingCellClient aggregatingClient,
                                        AggregatingJobManagementServiceHelper jobManagementServiceHelper);

}