Open SiteSearch 4.1.1
Final

ORG.oclc.webz
Class QUERY

java.lang.Object
  |
  +--ORG.oclc.webz.Verb
        |
        +--ORG.oclc.webz.ZVerb
              |
              +--ORG.oclc.webz.ZQueryHandler
                    |
                    +--ORG.oclc.webz.QUERY
Direct Known Subclasses:
AdvancedQuery, HistoryQuery, ThesaurusQuery, TopicQuery

public class QUERY
extends ZQueryHandler

The QUERY class is the WebZ Verb that performs a Z39.50 search and present. QUERY uses input parameters contained in a RequestManager object, or a RequestManager object and a string containing a URL. A successful execution of QUERY updates the UserStateObject with results of the search and sets up the next page or command for execution in the RequestManager object. If a failure occurs, the user variables code and msg are updated to contain the reason and the bad page or command for execution is set up in the RequestManager.

The processing flow of the QUERY class is to initialize the user for Z39.50 activity, parse the URL input parameters to generate the appropriate Z39.50 search request, create and send the search, perform a Z39.50 sort if requested, retrieve and save the first set of results records from the search, and set up the next command to execute in the RequestManager object.

The URL widgets recognized by the QUERY class are:
dbname or tdbname - the database name
dbgroup - the name of the database group for multiple database searches
format - the current element set name for record retrieval
numrecs - the current number of records to retrieve
fmtclass - the name of the format class for formatting records
recno - the record number of the first record to display
termxx - a query term
queryxx - a query term
limitxx - a limiting query term
indexxx - an index for a query term
operatorxx - an operator for a query term
next - the next command or page to process
bad - the failure command or page to process
keynn - a sort key for requesting sort on the query
directionnn - a sort key direction (a) or (d)

The search results are stored in the user's ZUserData object and are accessible using retrieval methods based on the resultset name of the search. The user state entities that are set as a result of a search are:
dbname - the database name(s) in the search
displaydbname - the database name corresponding the database records returned from the search
dbgroup - the group database name defining how to search a database group.
longdbname - the longname of the database
longdisplaydbname - the longname of the displaydbname database
resultset - the named resultset of the search
format - the current element set name
srchformat - the saved element set name for record retrieval on the search request
postings - the search result count
numrecs - the current number of records requested
srchnumrecs - the saved number of records to retrieve from the search
returnednumrecs - the number of records returned
fmtclass - the current formatting class
srchfmtclass - the saved name of the format class for formatting on the search request.
UnformattedRecordData - the Vector object containing the unformatted records returned from the search.
recno - the record number for a multi-record request
fullrecno - the record number for a format=F request
query - the query as sent in the Z39.50 request
displayquery - the query string suitable for display
index - the index abbreviation used on the query
code - the status of the search - see WebZErrors
msg - the error message for the search
qmsg the error message for query parsing failure
zcode - the Z39.50 error code - see Diagnostic1
zmsg - the Z39.50 error message
sortstatus - the status code from a sort - see WebZErrors
sortmsg - the sort error message

See Also:
FailurePage, SuccessPage, RequestManager, JavaPage, UserStateObject, ZQueryHandler, ZUserData, ZDb, ZServer, DbResults, Z39search, WebZErrors, Diagnostic1, Log

Field Summary
protected  String localformat
          String data type containing a local copy of the ElementSetName.
protected  DbResults[] sResults
          DbResults array object containing the search results.
 
Fields inherited from class ORG.oclc.webz.ZVerb
bytesIn, bytesOut, dbGroupSearch, dbname, fmtClass, format, inputQueryInfo, numrecs, postings, ranked, recno, resultSetName, sorting, tempDb, traceMsgs, z39session, zDb, zQueryTerm, zServer, zUserData
 
Fields inherited from class ORG.oclc.webz.Verb
user, widgets
 
Constructor Summary
QUERY()
          Constructs a QUERY object.
 
Method Summary
protected  void doDeleteResultSet()
          Issues a Z39.50 delete resulset request.
protected  void doPresent()
          Retrieves response records returned from the search if they were not sent as part of the search response and saves the unformatted records in the UserStateObject.
protected  void doQuery()
          Issues the Z39.50 search request and stores search results in the UserStateObject.
protected  void parseParms()
          Retrieves the search parameters from the incoming URL and invokes the Z3958 Query parser to create the Z3950 query string.
protected  void resumeQuery()
           
 void runit(RequestManager rMngr)
          Executes the QUERY class using the parameters in the RequestManager object.
 void runit(RequestManager rMngr, String URLCmd)
          Executes the QUERY class using the RequestManager object and the input parameters contained in the URLCmd.
 
Methods inherited from class ORG.oclc.webz.ZQueryHandler
getErrMsg, getErrno, parse
 
Methods inherited from class ORG.oclc.webz.ZVerb
doAccessControl, doSort, initZUser, restoreDbState, saveDbState, saveRecs, toString
 
Methods inherited from class ORG.oclc.webz.Verb
setUpPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sResults

protected DbResults[] sResults
DbResults array object containing the search results.

localformat

protected String localformat
String data type containing a local copy of the ElementSetName.
Constructor Detail

QUERY

public QUERY()
Constructs a QUERY object.
Method Detail

runit

public void runit(RequestManager rMngr)
Executes the QUERY class using the parameters in the RequestManager object. Each method called from the runit() method can throw a FailurePage exception. If this occurs, the catch logic for the exceptions invokes setup of the bad page or command to execute upon return. Successful execution of all steps sets up the next page for execution.
Parameters:
rMngr - the RequestManager object
Overrides:
runit in class Verb

runit

public void runit(RequestManager rMngr,
                  String URLCmd)
Executes the QUERY class using the RequestManager object and the input parameters contained in the URLCmd. This is used when creating a QUERY object from one of the application classes and sending in the query parameters in the URL String. Each method called from the runit() method can throw a FailurePage exception. If this occurs, the catch logic for the exceptions invokes setup of the bad page or command to execute upon return. Successful execution of all steps sets up the next page for execution.
Parameters:
rMngr - the RequestManager object
URLCmd - the command string with the widgets delimited by ":". For example, QUERY:next=results.html:query=dog:numrecs=10:format=B

parseParms

protected void parseParms()
                   throws FailurePage
Retrieves the search parameters from the incoming URL and invokes the Z3958 Query parser to create the Z3950 query string.
Throws:
FailurePage - the ZQueryHandler class is unable to create a Z39.50 query term

doDeleteResultSet

protected void doDeleteResultSet()
                          throws FailurePage
Issues a Z39.50 delete resulset request.
Throws:
FailurePage - unable to issue the Z39.50 DeleteResultSet or the request returned an error.

doQuery

protected void doQuery()
                throws FailurePage,
                       SuccessPage
Issues the Z39.50 search request and stores search results in the UserStateObject.
Throws:
FailurePage - unable to issue the Z39.50 Search or the Search request returned an error.
SuccessPage - the Z39.50 Search completed with no errors, but no records were found.

resumeQuery

protected void resumeQuery()
                    throws SuccessPage,
                           FailurePage

doPresent

protected void doPresent()
                  throws FailurePage
Retrieves response records returned from the search if they were not sent as part of the search response and saves the unformatted records in the UserStateObject.
Throws:
FailurePage - unable to issue the Z39.50 Present request, the Present request returned an error, or unable to load the formatting class.

Open SiteSearch 4.1.1
Final