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.DatasetService;
007
008import java.util.UUID;
009
010/**
011 * Iterates over all dataset constituents of a given super dataset.
012 */
013public class DatasetConstituentPager extends DatasetBasePager {
014
015    private final DatasetService service;
016    private final UUID datasetKey;
017
018    public DatasetConstituentPager(DatasetService service, UUID datasetKey, int pageSize) {
019        super(null, pageSize);
020        this.service = service;
021        this.datasetKey = datasetKey;
022    }
023
024    @Override
025    PagingResponse<Dataset> nextPage(PagingRequest page) {
026        return service.listConstituents(datasetKey, page);
027    }
028
029}