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


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


Set<String> getSortableProperties()
An implementation must report which of its properties can be legaly sorted.

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.


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


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


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.

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

Copyright © 2011, Oracle. All rights reserved.