Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2006 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.apps.groupspace.pagination
Class GS_PagedResult<T extends ContentBase>

    java.lang.Object
      com.bea.apps.groupspace.pagination.GS_PagedResult<T>

All Implemented Interfaces
  FilterablePagedResult, PagedResult, SortableFilterablePagedResult, SortablePagedResult, Serializable

    public class GS_PagedResult<T extends ContentBase>

extends Object
implements SortableFilterablePagedResult

GroupSpace-specific paged result, typed to ContentBase

See Also
  Serialized Form

Field Summary
`protected ContentFactory<T>` | `contentFactory`
`protected boolean` | `isResultPruned`

Fields inherited from interface com.bea.p13n.pagination.PagedResult
`COUNT_UNKNOWN`

Fields inherited from interface com.bea.p13n.pagination.PagedResult
`COUNT_UNKNOWN`

Constructor Summary
`GS_PagedResult(ContentContext cc, ISortableFilterablePagedList<Node> nodes, Class<T> beanClass, ContentFactory<T> contentFactory, int batchLoadingSize)`

Method Summary
`List<T>` | `asList()` Use this one when your PageResult was sorted
`Set<T>` | `asSet()` Use this one when you don't care about sorting
`void` | `close()` Close the result and release any resources which it holds.
`Iterator<T>` | `currentPage()` Get an iterator of the current page full of things.
`int` | `getCurrentPageNumber()` Get the current page number.
`Set<String>` | `getFilterableProperties()` An implementation must report which of its properties can be legaly filtered.
`Locale` | `getFilterLocale()` Retrieve the current locale used for filtering.
`FilterMethod` | `getFilterMethod()` Retrieve the current state of the filter method (what way the result is currently filtered).
`String` | `getFilterProperty()` Retrieve the current state of the property used to filter the result.
`String` | `getFilterString()` Retrieve the current state of the string used to filter the result.
`Iterator<T>` | `getPage(int pageNumber)` Get the specified page.
`int` | `getPageCount()` How many pages are available.
`int` | `getPageSize()` Get the size of the pages.
`Set<String>` | `getSortableProperties()` An implementation must report which of its properties can be legaly sorted.
`Locale` | `getSortLocale()` Retrieve the current locale used for sorting.
`SortOrder` | `getSortOrder()` Retrieve the current state of the sort order (what order the result is sorted by).
`String` | `getSortProperty()` Retrieve the current state of the property used to sort the result.
`Set<FilterMethod>` | `getSupportedFilterMethods()` An implementation must report which FilterMethods it supports.
`int` | `getTotalItemCount()` Get the total number of items represented by these pages.
`boolean` | `hasNextPage()` Is there a next page? Will a call to nextPage() succeed?
`boolean` | `hasPage(int pageNumber)` Does the given page exist? Should a call to getPage( pageNumber ) succeed? Generally, this means that getPageNumber() < getPageCount(), but some iterators may not allow random access to all pages, in which case this might return false even when you could get to that page using next/previous.
`boolean` | `hasPreviousPage()` Is there a previous page? Will a call to previousPage() succeed?
`boolean` | `isCompleteResults()` Does this result represent a complete set of results? If not, then probably the maximum number of query results was reached and this iterator only represents a subset of the actual query.
`boolean` | `isGetPageSupported()` Does this iterator allow random access to pages? This method (vs.
`boolean` | `isResultPruned()`
`Iterator<T>` | `nextPage()` Get an iterator of the next page full of things.
`Iterator<T>` | `previousPage()` Get an iterator of the previous page full of things.
`void` | `reFilter(FilterMethod filterMethod, String filterString, String filterProperty, Locale filterLocale)` Refilter the results.
`void` | `resize(int pageSize)` Set a new page size.
`void` | `reSort(SortOrder sortOrder, String sortProperty, Locale sortLocale)` Resort the results.
`void` | `setIsResultPruned(boolean isResultPruned)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### contentFactory

    protected ContentFactory<T extends ContentBase> contentFactory

### isResultPruned

    protected boolean isResultPruned

Constructor Detail

### GS_PagedResult

    public GS_PagedResult(ContentContext cc,
                          ISortableFilterablePagedList<Node> nodes,
                          Class<T> beanClass,
                          ContentFactory<T> contentFactory,
                          int batchLoadingSize)

Method Detail

### getPageSize

    public int getPageSize()

  Get the size of the pages. Each call to, for example, nextPage, should return (aproximately) this many items. Do not rely on this number to iterate thru the items, as some pages (like the last page) may have fewer.

  Specified by:
    `getPageSize` in interface `PagedResult`

### getTotalItemCount

    public int getTotalItemCount()

  Get the total number of items represented by these pages. Might return COUNT_UNKNOWN, if the number of items is indeterminant.

  Specified by:
    `getTotalItemCount` in interface `PagedResult`

### getPageCount

    public int getPageCount()

  How many pages are available. Sometimes this might be indeterminent, for example in a large search where the implementation does not know the true size of the result until it reaches the end. In that case, this method should return COUNT_UNKNOWN. If it does return a value, then getPage( getPageCount() - 1 ) must return the last page of results.

  Specified by:
    `getPageCount` in interface `PagedResult`

### isCompleteResults

    public boolean isCompleteResults()

  Does this result represent a complete set of results? If not, then probably the maximum number of query results was reached and this iterator only represents a subset of the actual query.

  Specified by:
    `isCompleteResults` in interface `PagedResult`

### isResultPruned

    public boolean isResultPruned()

### setIsResultPruned

    public void setIsResultPruned(boolean isResultPruned)

### getCurrentPageNumber

    public int getCurrentPageNumber()

  Get the current page number. This will be the number of the page retrieved by the last call to nextPage, previousPage, or getPage. If none of those methods have yet been called, it should return -1 (because the next page will be page 0, the first page).

  Specified by:
    `getCurrentPageNumber` in interface `PagedResult`

### hasNextPage

    public boolean hasNextPage()

  Is there a next page? Will a call to nextPage() succeed?

  Specified by:
    `hasNextPage` in interface `PagedResult`

### hasPreviousPage

    public boolean hasPreviousPage()

  Is there a previous page? Will a call to previousPage() succeed?

  Specified by:
    `hasPreviousPage` in interface `PagedResult`

### previousPage

    public Iterator<T> previousPage()
                                                 throws NoSuchElementException

  Get an iterator of the previous page full of things.

  Specified by:
    `previousPage` in interface `PagedResult`
  Throws
    `NoSuchElementException` - if there is no previous page.

### isGetPageSupported

    public boolean isGetPageSupported()

  Does this iterator allow random access to pages? This method (vs. hasPage) can be used by a GUI to decide if presenting a "go to page" button or field is appropriate.

  Specified by:
    `isGetPageSupported` in interface `PagedResult`

### hasPage

    public boolean hasPage(int pageNumber)

  Does the given page exist? Should a call to getPage( pageNumber ) succeed? Generally, this means that getPageNumber() < getPageCount(), but some iterators may not allow random access to all pages, in which case this might return false even when you could get to that page using next/previous.

  Specified by:
    `hasPage` in interface `PagedResult`

### getPage

    public Iterator<T> getPage(int pageNumber)
                                            throws IndexOutOfBoundsException,
                                                   UnsupportedOperationException

  Get the specified page.

  Specified by:
    `getPage` in interface `PagedResult`
  Throws
    `IndexOutOfBoundsException` - if the pageNumber is negative or is after the last page.
    `UnsupportedOperationException` - if this PageIterator does not support random access of pages (or of that page).

### close

    public void close()

  Close the result and release any resources which it holds. Users must call this when finished using this object.

  Specified by:
    `close` in interface `PagedResult`

### resize

    public void resize(int pageSize)
                throws IllegalArgumentException

  Set a new page size. When a new page size is set, a PageIterator is REQUIRED to reset itself to "before" page one, so that nextPage will then return a new first page with the new sizing.

  Specified by:
    `resize` in interface `PagedResult`
  Throws
    `IllegalArgumentException` - if pageSize is less than or equal to zero

### nextPage

    public Iterator<T> nextPage()
                                             throws NoSuchElementException

  Get an iterator of the next page full of things.

  Specified by:
    `nextPage` in interface `PagedResult`
  Throws
    `NoSuchElementException` - if there is no next page.

### currentPage

    public Iterator<T> currentPage()
                                                throws NoSuchElementException

  Get an iterator of the current page full of things.

  Throws
    `NoSuchElementException` - if there is no next page.

### getSortOrder

    public SortOrder getSortOrder()

  Retrieve the current state of the sort order (what order the result is sorted by).

  Specified by:
    `getSortOrder` in interface `SortablePagedResult`

### getSortableProperties

    public Set<String> getSortableProperties()

  An implementation must report which of its properties can be legaly sorted.

  Specified by:
    `getSortableProperties` in interface `SortablePagedResult`
  Returns
    a set of strings naming sortable properties which can be used with reSort's sortProperty. May not be null, if no properties are sortable this method should return an empty set.

### getSortProperty

    public String getSortProperty()

  Retrieve the current state of the property used to sort the result. This property should match one of the java bean properties of the type being sorted. Might be null if the sortOrder is UNSORTED. Some implementations may ignore this property if the results (T) are single-valued (i.e. Strings usually).

  Specified by:
    `getSortProperty` in interface `SortablePagedResult`

### getSortLocale

    public Locale getSortLocale()

  Retrieve the current locale used for sorting. Null means that Locale is not considered when sorting. Even if set, the implementation might ignore the locale for some sort properties (i.e. numbers, which sort the same in any locale).

  Specified by:
    `getSortLocale` in interface `SortablePagedResult`

### reSort

    public void reSort(SortOrder sortOrder,
                       String sortProperty,
                       Locale sortLocale)
                throws UnsupportedOperationException

  Resort the results. This should result in resetting the PagedResult's current page to "before page one", since the results will be quite different. It should also reset the internal state of sortOrder, sortProperty, and sortLocale to that indicated by the reSort.

  Most implementations should not simply reorder the current data, but should rather reissue page queries to retrieve sorted results.

  Specified by:
    `reSort` in interface `SortablePagedResult`
  Parameters
    `sortOrder` - the new order to use for sorting. Null is not allowed.
    `sortProperty` - the property of the result to use for sorting. If sortOrder is UNSORTED, this property is probably ignored (and reSort is not actually required to do anything at all). Must not be null or empty, unless sortOrder is UNSORTED or the implementation chooses to ignore it. Otherwise this must be one of the properties reported by getSortableProperties.
    `sortLocale` - locale used to sort. Null implies that sorting should not be based on Locale. Might be ignored if the bean or property being sorted does not support locale-based sorting (i.e. the property is an Integer).
  Throws
    `UnsupportedOperationException` - if the sort can not be performed on the given property.
    `IllegalArgumentException` - if sortOrder is null, or if the sortProperty is null or empty string when sortOrder is something other than UNSORTED.

### getSupportedFilterMethods

    public Set<FilterMethod> getSupportedFilterMethods()

  An implementation must report which FilterMethods it supports. All implementations must support UNFILTERED, but some may, for example, only be able to support EQUALS and/or BEGINS_WITH. This method should return the set of supported methods. It must not be null, and needs not include UNFILTERED (but may), as this is implicitly required. Most implementations will probably return something like EnumSet.allOf( FilterMethod.class ).

  Specified by:
    `getSupportedFilterMethods` in interface `FilterablePagedResult`

### getFilterableProperties

    public Set<String> getFilterableProperties()

  An implementation must report which of its properties can be legaly filtered.

  Specified by:
    `getFilterableProperties` in interface `FilterablePagedResult`
  Returns
    a set of strings naming filterable properties which can be used with reFilter's filterProperty. May not be null, if the result type (T) is single-vauled (i.e. a String), and does not filter based on properties, then this method should return an empty set.

### getFilterMethod

    public FilterMethod getFilterMethod()

  Retrieve the current state of the filter method (what way the result is currently filtered).

  Specified by:
    `getFilterMethod` in interface `FilterablePagedResult`

### getFilterString

    public String getFilterString()

  Retrieve the current state of the string used to filter the result. Might be null if the filterMethod is UNFILTERED.

  Specified by:
    `getFilterString` in interface `FilterablePagedResult`

### getFilterProperty

    public String getFilterProperty()

  Retrieve the current state of the property used to filter the result. Generally, must match one of the values returned by getFilterableProperties, however it might be null if the filterMethod is UNFILTERED. Some implementations may ignore this property if the results (T) are single-valued (i.e. Strings usually). In this case getFilterableProperties should return an empty array.

  Specified by:
    `getFilterProperty` in interface `FilterablePagedResult`

### getFilterLocale

    public Locale getFilterLocale()

  Retrieve the current locale used for filtering. Null means that Locale is not considered when filtering. Even if set, the implementation might ignore the locale for some properties. In order for locale-based filtering to make sense, the filter property will need different values for various locales.

  Specified by:
    `getFilterLocale` in interface `FilterablePagedResult`

### reFilter

    public void reFilter(FilterMethod filterMethod,
                         String filterString,
                         String filterProperty,
                         Locale filterLocale)
                  throws UnsupportedOperationException,
                         IllegalArgumentException

  Refilter the results. This should result in resetting the PagedResult's current page to "before page one", since the results will be quite different. It should also reset the internal state of filterMethod, filterExpression, filterProperty, and filterLocale to those indicated by the reFilter arguments. Most implementations should not simply subset the current data, but should rather reissue page queries to retrieve filtered results.

  Specified by:
    `reFilter` in interface `FilterablePagedResult`
  Parameters
    `filterMethod` - the new method to use for filtering. Null is not allowed.
    `filterString` - the string to use for filtering. If filterMethod is UNFILTERED, this is probably ignored, but reFilter should then reissue the query to return a full unfiltered set of results. May not be null or empty, unlesss filterMethod is UNFILTERED.
    `filterProperty` - the property of the result to use for filtering. If filterMethod is UNFILTERED, this property is probably ignored (and reFilter simply resets to the full result set). Must not be null or empty, unless filterMethod is UNFILTERED or the implementation chooses to ignore it. Oherwise this should match one of the names returned by getFilterableProperties.
    `filterLocale` - locale used to filter. Null implies that filtering should not be based on Locale. Might be ignored if the bean or property being filtered does not support locale-based filtering (i.e. the property is an Integer or has no associated localized content).
  Throws
    `UnsupportedOperationException` - if filtering can not be performed for the given property or method.
    `IllegalArgumentException` - if filterMethod is null, or if the filterExpression or filterPropery are null or empty string when filterMethod is anything other than UNFILTERED.

### asSet

    public Set<T> asSet()

  Use this one when you don't care about sorting

  Returns
    A HashSet of T, which ignores sorting

### asList

    public List<T> asList()

  Use this one when your PageResult was sorted

  Returns
    A synchronized ArrayList of T, in the order retrieved from the underlying node paged result.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 BEA Systems, Inc. All Rights Reserved