public List<QueryPageRow> build() {
validate();
int skipped = 0;
Integer pageSize = pageRequest.getPageSize();
int startRowIndex = pageRequest.getStartRowIndex();
RepositoryFilter filter = new AssetItemFilter();
List<QueryPageRow> rowList = new ArrayList<QueryPageRow>();
while ( iterator.hasNext() && (pageSize == null || rowList.size() < pageSize) ) {
AssetItem assetItem = (AssetItem) iterator.next();
// Filter surplus assets
if ( filter.accept( assetItem,
RoleType.PACKAGE_READONLY.getName() ) ) {
// Cannot use AssetItemIterator.skip() as it skips non-filtered
// assets whereas startRowIndex is the index of the
// first displayed asset (i.e. filtered)