Exemple #1
0
  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;
  }
Exemple #2
0
 public Sorting getSorting() {
   return listHandler.getSorting();
 }
Exemple #3
0
 public int size() {
   return listHandler.size();
 }