Hi All,

As described in JIRA issue https://issues.apache.org/jira/browse/TRINIDAD-2353, I would like to add a new interface RowLimitMutator which identifies a collection whose row limit can be mutated. Row limit is the maximum number of rows a collection can hold, there are cases where a row limit is enforced for a collection for performance reasons, while such limit should be lifted when certain operation (e.g. Export to a file) is performed on the collection. This interfaces identifies such collection that the row limit can be changed.

package org.apache.myfaces.trinidad.model;

/**
 * Identifies a collection whose row limit can be mutated.
 */
public interface RowLimitMutator
{
  /**
   * Mutate the row limit of this collection, it returns the old row limit.
   * @param newLimit the new limit of this collection to set to.
* A positive number: the maximum number of rows the collection can hold.
   *   CollectionModel.UNKNOWN_ROW_LIMIT: row limit is unknown.
   *   CollectionModel.UNLIMITED_ROW: there is no limit
   * @returns the old row limit.
* @throws IllegalArgumentException if <em>newLimit</em> is 0 or any negative number * other than CollectionModel.UNKNOWN_ROW_LIMIT and CollectionModel.UNLIMITED_ROW.
   */
  public int setRowLimit(int newLimit);
}

CollectionModel is updated to define the row limit constants, and also provides the default implementation of retrieving row limit method.

  /**
* Gets the row limit of this collection model. Default is to return UNKNOWN_ROW_LIMIT.
   * Subclasses should override this method if row limit is enforced.
* @return the maximum number of rows this collection can hold, possible return values are: * A positive number: the maximum number of rows the collection can hold
   *   UNKNOWN_ROW_LIMIT: row limit is unknown.
   *   UNLIMITED_ROW: there is no limit
   */
  public int getRowLimit()
  {
    return UNKNOWN_ROW_LIMIT;
  }

  public final static int UNLIMITED_ROW = -2;
  public final static int UNKNOWN_ROW_LIMIT = -1;



If anyone has questions/comments on this, please let me know.


Thanks,
Jing



Reply via email to