com.bigllc.retsiq.simpleclient
Interface SearchResponseHandler

All Known Implementing Classes:
AbstractSearchResponseHandler, ColumnRenameResponseHandler, DelimitedSearchResponseHandler, RawOutputResponseHandler, RecordCollectionResponseHandler

public interface SearchResponseHandler

Interface for handling search responses. Results are streamed to handler implementations so that large result sets can be processed efficiently.

Author:
Marc G. Smith

Method Summary
 void columns(java.util.List<java.lang.String> columns)
          If results are returned then this method is called with the column headers returned.
 void count(int count)
          If a count was returned in the search response.
 void data(java.util.List<java.lang.String> data)
          If results are returned then the this method is called for each record returned.
 void delimiter(java.lang.String hex)
          If a delimiter is specified in the response then this method is called with the byte delimiter as hexidecimal string.
 void done()
          On completion of processing of the search results or if a parsing error occurs then this called.
 java.lang.String getPath()
          Get the path requested for the search.
 java.lang.String getQuery()
          Get the query requested for the search.
 int getRecordsInResponse()
          Return the number of records processed in this search response.
 java.util.List<java.lang.String> getSelect()
          Get the columns requested for the search.
 RETSUserSession getSession()
          Get the user session used for the search.
 void hasMoreData()
          If the results returned have been limited by either the user or the server and more results are available then this method will be called.
 void noRecordsFound()
          Callback when search was successful but specifically no records were found.
 void responseCode(int code, java.lang.String text, java.lang.String description)
          Callback for search RETS response code.
 void setContext(RETSUserSession session, java.lang.String path, java.lang.String query, java.util.List<java.lang.String> select)
          Set the search context for the results being parsed.
 

Method Detail

getRecordsInResponse

int getRecordsInResponse()
Return the number of records processed in this search response.

Returns:
The number of records in the response.

getSelect

java.util.List<java.lang.String> getSelect()
Get the columns requested for the search.

Returns:
A list of columns that were requested. An empty list or null may be returned if all columns were specified.
See Also:
RETSUserSession.search(String, String, List, SearchResponseHandler)

getPath

java.lang.String getPath()
Get the path requested for the search.

Returns:
A search path as defined in RETSUserSession.
See Also:
RETSUserSession.search(String, String, List, SearchResponseHandler)

getQuery

java.lang.String getQuery()
Get the query requested for the search.

Returns:
The DMQL2 query.
See Also:
RETSUserSession.search(String, String, List, SearchResponseHandler)

getSession

RETSUserSession getSession()
Get the user session used for the search.

Returns:
The user session.
See Also:
RETSUserSession.search(String, String, List, SearchResponseHandler)

responseCode

void responseCode(int code,
                  java.lang.String text,
                  java.lang.String description)
Callback for search RETS response code. A code of 0 represents search was successful, a code of 20201 means no records were found.

Parameters:
code - The RETS response code.
text - The text associated with the response code.
description - An associated long description of the response code.

noRecordsFound

void noRecordsFound()
Callback when search was successful but specifically no records were found.


count

void count(int count)
If a count was returned in the search response. This method will be called with the value. The count represents the number of records that match the query not necessarily the number of records in the response.


delimiter

void delimiter(java.lang.String hex)
If a delimiter is specified in the response then this method is called with the byte delimiter as hexidecimal string.

Parameters:
hex - The byte delimiter as a hexidecimal string.

columns

void columns(java.util.List<java.lang.String> columns)
             throws RETSClientException
If results are returned then this method is called with the column headers returned. The order of the list is maintained as per the search results. If no results or an error occurs then this method will not be called.

Parameters:
columns - A list of column names.
Throws:
RETSClientException

data

void data(java.util.List<java.lang.String> data)
          throws RETSClientException
If results are returned then the this method is called for each record returned. The order of the list is maintained as per the search results and will match the indexes of the list of column headers. If no results or an error occurs then this method will not be called.

Parameters:
data - A list of the record fields.
Throws:
RETSClientException

hasMoreData

void hasMoreData()
If the results returned have been limited by either the user or the server and more results are available then this method will be called.


done

void done()
On completion of processing of the search results or if a parsing error occurs then this called.


setContext

void setContext(RETSUserSession session,
                java.lang.String path,
                java.lang.String query,
                java.util.List<java.lang.String> select)
Set the search context for the results being parsed. This will be called by the parser and should not be called directly by any implementing classes.

Parameters:
session - The user session.
path - The search path.
query - The DMQL2 query.
select - The columns selected to be returned or null for all.
See Also:
RETSUserSession.search(String, String, List, SearchResponseHandler)