class BrowseServiceImpl extends ComponentSupport implements BrowseService {

  @Override
  public PageResult<Asset> browseAssets(final Repository repository,
                                          final QueryOptions queryOptions)
  {
    checkNotNull(repository);
    final List<Repository> repositories = getRepositories(repository);
    try (StorageTx storageTx = repository.facet(StorageFacet.class).txSupplier().get()) {
      storageTx.begin();
      List<String> bucketIds = getBucketIds(storageTx, repositories);
      List<Asset> assets = Collections.emptyList();
      // ensure there are assets before incurring contentAuth overhead
      if (hasAssets(storageTx, repository, bucketIds, queryOptions)) {
        assets = getAssets(browseAssetIterableFactory.create(
            storageTx.getDb(), queryOptions.getLastId(), repository.getName(), bucketIds, queryOptions.getLimit()));
      }
      return new PageResult<>(queryOptions, assets);
    }
  }

  @Inject public  BrowseServiceImpl(@Named(GroupType.NAME) final Type groupType,
                           final ComponentEntityAdapter componentEntityAdapter,
                           final VariableResolverAdapterManager variableResolverAdapterManager,
                           final ContentPermissionChecker contentPermissionChecker,
                           final AssetEntityAdapter assetEntityAdapter,
                           final BrowseAssetIterableFactory browseAssetIterableFactory,
                           final BrowseAssetsSqlBuilder browseAssetsSqlBuilder,
                           final BrowseComponentsSqlBuilder browseComponentsSqlBuilder,
                           final BucketStore bucketStore,
                           final RepositoryManager repositoryManager);

}