public void query(int ofst, Sorting srtg, boolean force) throws EmptyListException, IndexOutOfBoundsException, ListingException { if (!force && listHandler.size() < 1) { throw new EmptyListException("No list elements exist"); } if (ofst < 0 || (!force && ofst > listHandler.size() - 1)) { throw new IndexOutOfBoundsException("Listing offset " + ofst + " is out of bounds"); } // do we need to actually re-query? final Sorting sorting = getSorting(); if (!force && elements != null && this.offset == ofst && sorting != null && sorting.equals(srtg)) { return; } // query final int psize = pageSize == -1 ? listHandler.size() : pageSize; try { elements = listHandler.getElements(ofst, psize, srtg); } catch (final EmptyListException e) { throw e; } catch (final ListHandlerException e) { throw new ListingException(listingId, e.getMessage()); } // update offset this.offset = ofst; }
public Sorting getSorting() { return listHandler.getSorting(); }
public int size() { return listHandler.size(); }