use of org.eclipse.hono.service.management.tenant.TenantWithId in project hono by eclipse.
the class MongoDbBasedTenantDao method find.
/**
* {@inheritDoc}
*/
@Override
public Future<SearchResult<TenantWithId>> find(final int pageSize, final int pageOffset, final List<Filter> filters, final List<Sort> sortOptions, final SpanContext tracingContext) {
Objects.requireNonNull(filters);
Objects.requireNonNull(sortOptions);
if (pageSize <= 0) {
throw new IllegalArgumentException("page size must be a positive integer");
}
if (pageOffset < 0) {
throw new IllegalArgumentException("page offset must not be negative");
}
final Span span = tracer.buildSpan("find Tenants").addReference(References.CHILD_OF, tracingContext).start();
final JsonObject filterDocument = MongoDbDocumentBuilder.builder().withTenantFilters(filters).document();
final JsonObject sortDocument = MongoDbDocumentBuilder.builder().withTenantSortOptions(sortOptions).document();
return processSearchResource(pageSize, pageOffset, filterDocument, sortDocument, MongoDbBasedTenantDao::getTenantsWithId).onFailure(t -> TracingHelper.logError(span, "error finding tenants", t)).onComplete(r -> span.finish());
}
Aggregations