Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.pagination
Interface SortablePagedResult<T>

All Superinterfaces
  PagedResult<T>, Serializable

All Known Subinterfaces:
  ICMPagedResult<T>, SortableFilterablePagedResult<T>

    public interface SortablePagedResult<T>

extends PagedResult<T>

A PagedResult which can be sorted. Sorting is done using property names and a SortOrder indicator.

It is generally expected that most implementations will be backed by something like database queries, and should be optimized for paganated access. That is, rather than retrieving a full set of results into memory and sorting those results, the implementation should retrieve results, sorted by the database, a page (or a few pages) at a time, and return those via the PagedResults interface.

Field Summary

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

Method Summary
`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.
`void` | `reSort(SortOrder sortOrder, String sortProperty, Locale sortLocale)` Resort the results.

Methods inherited from interface com.bea.p13n.pagination.PagedResult
`close, getCurrentPageNumber, getPage, getPageCount, getPageSize, getTotalItemCount, hasNextPage, hasPage, hasPreviousPage, isCompleteResults, isGetPageSupported, nextPage, previousPage, resize`

Method Detail

### getSortOrder

    SortOrder getSortOrder()

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

### getSortableProperties

    Set<String> getSortableProperties()

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

  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

    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).

### getSortLocale

    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).

### reSort

    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.

  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.

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

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.