All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.molgenis.data.support.BatchingQueryResult Maven / Gradle / Ivy

There is a newer version: 8.4.5
Show newest version
package org.molgenis.data.support;

import java.util.List;
import org.molgenis.data.Entity;
import org.molgenis.data.Query;
import org.molgenis.data.util.BatchingIterable;

/**
 * BatchingIterable that batches a Query.
 *
 * 

It changes the query's offset and pageSize of each batch. */ public abstract class BatchingQueryResult extends BatchingIterable { private final Query query; public BatchingQueryResult(int batchSize, Query query) { super(batchSize, query.getOffset(), query.getPageSize()); this.query = query; } @Override protected List getBatch(int offset, int batchSize) { Query batchQuery; if (offset != query.getOffset() || batchSize != query.getPageSize()) { batchQuery = new QueryImpl<>(query).setOffset(offset).setPageSize(batchSize); } else { batchQuery = query; } return getBatch(batchQuery); } protected abstract List getBatch(Query q); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy