Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.search.api.client.search.results.impl
Class ResultSetImpl

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<ResultItem>
              extended by org.nuxeo.ecm.core.search.api.client.search.results.impl.ResultSetImpl
All Implemented Interfaces:
Serializable, Cloneable, Iterable<ResultItem>, Collection<ResultItem>, List<ResultItem>, RandomAccess, ResultSet

public class ResultSetImpl
extends ArrayList<ResultItem>
implements ResultSet

Result set implementation.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.core.search.api.client.search.results.ResultSet
ALWAYS_DETACH_SEARCH_RESULTS_KEY
 
Constructor Summary
ResultSetImpl(String query, CoreSession session, int offset, int range, List<ResultItem> resultItems, int totalHits, int pageHits)
          Constructor used when a CoreSession is available.
 
Method Summary
 boolean detachResults()
           
 int getOffset()
          Returns the current offset for this result set.
 int getPageHits()
          Returns the amount of actual matching results.
 int getPageNumber()
          Computes the page number among the total set of results.
 int getRange()
          Returns the amount of results from offset requested.
 int getTotalHits()
          Returns the total number of hits this resultset comes from.
 ResultSet goToPage(int page)
          Goes to requested page.
 boolean hasNextPage()
          Is there another page available?
 boolean isFirstPage()
          Is this result set the first page of results?
 ResultSet nextPage()
          Computes the next page by replaying the exact same request.
 ResultSet replay()
          Replays the exact same query.
 ResultSet replay(int offset, int range)
          Replays the same query with new offset and range.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Constructor Detail

ResultSetImpl

public ResultSetImpl(String query,
                     CoreSession session,
                     int offset,
                     int range,
                     List<ResultItem> resultItems,
                     int totalHits,
                     int pageHits)
Constructor used when a CoreSession is available.

Method Detail

detachResults

public boolean detachResults()

getOffset

public int getOffset()
Description copied from interface: ResultSet
Returns the current offset for this result set.

Specified by:
getOffset in interface ResultSet
Returns:
the offset as an integer.

getRange

public int getRange()
Description copied from interface: ResultSet
Returns the amount of results from offset requested.

Specified by:
getRange in interface ResultSet
Returns:
the amount of results from offset requested.

nextPage

public ResultSet nextPage()
                   throws SearchException
Description copied from interface: ResultSet
Computes the next page by replaying the exact same request.

Specified by:
nextPage in interface ResultSet
Returns:
the next computed page or null if there is none.
Throws:
SearchException

goToPage

public ResultSet goToPage(int page)
                   throws SearchException
Description copied from interface: ResultSet
Goes to requested page.

Specified by:
goToPage in interface ResultSet
Parameters:
page - the page to go to
Returns:
the next computed page or null if there is none.
Throws:
SearchException

getTotalHits

public int getTotalHits()
Description copied from interface: ResultSet
Returns the total number of hits this resultset comes from.

Specified by:
getTotalHits in interface ResultSet
Returns:
an integer value

getPageHits

public int getPageHits()
Description copied from interface: ResultSet
Returns the amount of actual matching results.

This is in contrast to getRange() that returns the maximum number of results per page.

Specified by:
getPageHits in interface ResultSet
Returns:
the amount of actual matching results.

hasNextPage

public boolean hasNextPage()
Description copied from interface: ResultSet
Is there another page available?

Specified by:
hasNextPage in interface ResultSet
Returns:
true if next page available / false if not.

isFirstPage

public boolean isFirstPage()
Description copied from interface: ResultSet
Is this result set the first page of results?

Specified by:
isFirstPage in interface ResultSet
Returns:
true if first page / false of not.

replay

public ResultSet replay()
                 throws SearchException
Description copied from interface: ResultSet
Replays the exact same query.

Specified by:
replay in interface ResultSet
Returns:
a new, updated ResultSet
Throws:
SearchException

replay

public ResultSet replay(int offset,
                        int range)
                 throws SearchException
Description copied from interface: ResultSet
Replays the same query with new offset and range.

Specified by:
replay in interface ResultSet
Parameters:
offset - the new offset
range - the new range
Returns:
a new, updated ResultSet
Throws:
SearchException

getPageNumber

public int getPageNumber()
Description copied from interface: ResultSet
Computes the page number among the total set of results.

Specified by:
getPageNumber in interface ResultSet
Returns:
the page number

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.