001package org.gbif.api.util.iterables;
002
003import org.gbif.api.model.common.paging.PagingRequest;
004import org.gbif.api.model.common.paging.PagingResponse;
005import org.gbif.api.model.registry.Dataset;
006import org.gbif.api.service.registry.OrganizationService;
007import org.gbif.api.vocabulary.DatasetType;
008
009import java.util.UUID;
010import javax.annotation.Nullable;
011
012/**
013 * Iterates over all datasets published by a given organisation.
014 */
015public class OrgPublishingPager extends DatasetBasePager {
016
017    private final OrganizationService os;
018    private final UUID orgKey;
019
020    public OrgPublishingPager(OrganizationService os, UUID orgKey, @Nullable DatasetType type, int pageSize) {
021        super(type, pageSize);
022        this.os = os;
023        this.orgKey = orgKey;
024    }
025
026    @Override
027    PagingResponse<Dataset> nextPage(PagingRequest page) {
028        return os.publishedDatasets(orgKey, page);
029    }
030
031}