com.ibm.itim.dataservices.model

Interface SearchResultsIterator



  • public interface SearchResultsIterator
    Interface for iterating over a set of search results (see SearchResults). The interface is structured so that implementing classes may employ more efficient streaming algorithms, whereby the implementing classes may stream results in from the datastore in parallel to a client's processing of the returned results. The key is in the exception/error handling portion of the interface, where errors that may be encountered at any point in the data retrieval can be deferred to the entry that caused the error, allowing for best effort retrieval of data, instead of a rigid all or nothing approach. If an error is detected at any point in the retrieval of data, however, the iterator will become invalid and unable to be used further.
    See Also:
    SearchResults
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      boolean hasNext()
      Determines whether there are any more results in the iterator.
      java.lang.Object next()
      Retrieves the next result in the iterator.
      void remove()
      Removes from the underlying search results the last result returned by the iterator.
    • Method Detail

      • hasNext

        boolean hasNext()
                 throws PartialResultsException
        Determines whether there are any more results in the iterator. This method allows exceptions encountered while determining whether there are more results to be caught and handled by the application.
        Returns:
        True if more results exist, false if not.
        Throws:
        PartialResultsException - Thrown if an error was detected trying to determine if any more results exist.
      • next

        java.lang.Object next()
                       throws PartialResultsException
        Retrieves the next result in the iterator. This method allows exceptions encountered while retrieving the next result to be caught and handled by the application. Note that next() can also throw the runtime exception NoSuchElementException to indicate that the caller is attempting to iterate beyond the end of the iterator. This is different from a PartialResultsException, which indicates that there was a problem in obtaining the next result, for example, due to server unavailability, size limit exceeded, etc.
        Returns:
        Next result in the iterator.
        Throws:
        PartialResultsException - Thrown if an error was detected trying to obtain the next result in the iterator, possibly due to server unavailability or a size limit being exceeded.
        java.util.NoSuchElementException - If attempting to get the next result when none is available.
      • remove

        void remove()
        Removes from the underlying search results the last result returned by the iterator. This method can be called only once per call to next.