public class TdbSearch extends TdbMessageProvider implements java.lang.Iterable<TdbSearchSet>
This class provides high-level functionality pertaining to search and retrieval; it uses the same protocols as the TdbRecordSet and the TdbCclCommand classes to communicate with the server.
For examples of how to use this class, please see the example classes com.tietoenator.trip.jxp.examples.data.Search and com.tietoenator.trip.jxp.examples.data.SearchSetIteration.
Constructor and Description |
---|
TdbSearch(TdbSession session)
Constructor, creates a blank instance.
|
Modifier and Type | Method and Description |
---|---|
TdbSearchSet |
addSearchSet(int searchId)
Associates a pre-existing search set with this TdbSearch instance.
|
void |
cancel()
Cancel xml transaction
|
void |
clear()
Resets the state of the TdbSearch object.
|
void |
close()
Release server resources associated with this TdbSearch instance.
|
void |
execute(java.lang.String cclStatement)
Execute a CCL statement.
|
void |
executeXPath(java.lang.String xpathStatement)
Execute an XPath statement as a query.
|
TdbKernelWindow |
getAffectedWindow()
Returns a TdbKernelWindow object for the the kernel window affected
by the most recent command.
|
boolean |
getAutomaticRetrievalTemplate()
Determines if retrieval templates are to be automatically created
(default: true).
|
TdbCclCommandType |
getCommandType()
Retrieve the type of command executed.
|
java.lang.String |
getCurrentBase()
Retrieve the name of the currently open database or cluster.
|
java.lang.String |
getCurrentThesaurusDef()
Returns the definition string used for the currently defined thesaurus,
or an empty string if no thesaurus is defined.
|
java.lang.String |
getCurrentThesaurusName()
Returns the name of the currently defined thesaurus, or an empty
string if no thesaurus is defined.
|
TdbSearchSet |
getLastSearchSet()
Returns a TdbSearchSet object for the last search conducted via this
TdbSearch instance.
|
TdbSearchSet |
getSearchSet(int index)
Returns a TdbSearchSet object for a search associated with this TdbSearch instance.
|
TdbSearchSet |
getSearchSetById(int searchId)
Retrieve a TdbSearchSet object for the specified search id.
|
int |
getSearchSetCount()
The number of search sets associated with this TdbSearch object.
|
int[] |
getSearchSetNumbers()
An array of the search set numbers associated with this search set.
|
TdbTermList |
getTermList()
Get the instance of TdbTermList that handles the results of
non-hierarchical DISPLAY commands.
|
int |
getTermListTimeout()
Get timeout for on-demand term lists generated by future DISPLAY commands.
|
TdbTermTree |
getTermTree()
Get the instance of TdbTermTree that handles the results
of hierarchical (i.e.
|
boolean |
getUseOnDemandTermLists()
Returns true if term lists created via this TdbSearch instance
are on-demand and also possible to use concurrently.
|
java.util.Iterator<TdbSearchSet> |
iterator()
Returns an iterator over the search sets in the current search object.
|
java.util.List<TdbSearchSet> |
searchSets()
A read-only list of the TdbSearchSet objects associated with
this TdbSearch instance.
|
void |
setAutomaticRetrievalTemplate(boolean enable)
Determines if retrieval templates are to be automatically created
(default: true).
|
void |
setCancelable(boolean cancelable)
Set cancelable state
|
void |
setRetrievalTemplate(TdbRecord newTemplate)
Set the default retrieval template for records to retrieve.
|
void |
setTermList(TdbTermList terms)
Assign a new instance of TdbTermList to handle the results of
non-hierarchical DISPLAY commands.
|
void |
setTermListTimeout(int seconds)
Set timeout for on-demand term lists generated by future DISPLAY commands.
|
void |
setUseOnDemandTermLists(boolean enable)
Enable or disable the use of the on-demand term list feature.
|
codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages
getSession, isCancelable
public TdbSearch(TdbSession session) throws TdbException
session
- Active sessionTdbException
public TdbSearchSet getLastSearchSet()
public java.util.List<TdbSearchSet> searchSets()
public int getSearchSetCount()
public int[] getSearchSetNumbers()
public TdbSearchSet getSearchSet(int index) throws TdbException
index
- The zero-based index of the search set in this TdbSearchTdbException
public TdbSearchSet addSearchSet(int searchId) throws TdbException
searchId
- ID of search set to associate with this TdbSearch instance.TdbException
public TdbKernelWindow getAffectedWindow()
public TdbCclCommandType getCommandType()
public TdbTermList getTermList()
public void setTermList(TdbTermList terms)
terms
- A TdbTermList instance.public TdbTermTree getTermTree()
public void setRetrievalTemplate(TdbRecord newTemplate)
newTemplate
- The retrieval template to assign as default for
search sets subsequently created via this TdbSearch object.public boolean getAutomaticRetrievalTemplate()
public void setAutomaticRetrievalTemplate(boolean enable)
enable
- True to enable automatic retrieval templates.public java.lang.String getCurrentBase()
public java.lang.String getCurrentThesaurusName()
At least one CCL command that has caused the thesaurus definition to change or generated a search set must have been issued using this TdbSearch instance before thesaurus information is available.
This method requires TRIPsystem 8.0-2 or later.
public java.lang.String getCurrentThesaurusDef()
At least one CCL command that has caused the thesaurus definition to change or generated a search set must have been issued using this TdbSearch instance before thesaurus information is available.
This method requires TRIPsystem 8.0-2 or later.
public boolean getUseOnDemandTermLists()
TdbTripFeature.OnDemandTermLists
public void setUseOnDemandTermLists(boolean enable) throws TdbException
enable
- True to use on-demand term listsTdbException
- If on-demand term lists cannot be enabledTdbTripFeature.OnDemandTermLists
public void setTermListTimeout(int seconds)
On-demand term lists requires resources on the server to keep alive. By default, they will time out in 120 seconds. After an on-demand term list has timed out, terms from it will no longer be possible to retrieve by the application without executing the DISPLAY order again.
Although it isn't always a good practise to do so, the timeout can be disabled by setting this value to zero.
seconds
- Timeout to setTdbSearch.setUseOnDemandTermLists(boolean)
public int getTermListTimeout()
On-demand term lists requires resources on the server to keep alive. By default, they will time out in 120 seconds. After an on-demand term list has timed out, terms from it will no longer be possible to retrieve by the application without executing the DISPLAY order again.
public void clear()
public void close() throws TdbException
After a call to this method, the current TdbSearch instance is no longer valid.
TdbException
public TdbSearchSet getSearchSetById(int searchId)
searchId
- The id number of the search set to retrieve.public void execute(java.lang.String cclStatement) throws TdbException
This method accepts any type of CCL command, and not only those that generate search sets. The state of the TdbSearch object after a successful call will reflect the command just executed.
cclStatement
- Statement to executeTdbException
public void executeXPath(java.lang.String xpathStatement) throws TdbException
This method executes an XPath statement as a query. An XML database must be open in order for this to work. Also, the server to which the current session is connected runs TRIPsystem 6.2-7 or later and TRIPxml 3.0 or later.
xpathStatement
- Statement to executeTdbException
public java.util.Iterator<TdbSearchSet> iterator()
iterator
in interface java.lang.Iterable<TdbSearchSet>
public void setCancelable(boolean cancelable) throws TdbException
TdbSessionObject
setCancelable
in class TdbSessionObject
cancelable
- true if object is cancelableTdbException
public void cancel() throws TdbException
TdbSessionObject
cancel
in class TdbSessionObject
TdbException