com.raritantechnologies.utils.tree
Class TreeSearchSource
java.lang.Object
com.raritantechnologies.searchApp.SearchSource
com.raritantechnologies.utils.tree.TreeSearchSource
- All Implemented Interfaces:
- IQueryProcessor, IXMLSearchSourceFactory
- public class TreeSearchSource
- extends SearchSource
- implements IQueryProcessor, IXMLSearchSourceFactory
Provides a search interface to a Tree with attributes. Uses an InMemorySearchSource internally.
XML Configuration Template:
<SourceType name=TreeSource" type="TreeSearchSource"
sourceFactoryClass="com.raritantechnologies.utils.tree.TreeSearchSource"
queryProcessor="com.raritantechnologies.utils.tree.TreeSearchSource"
treeBuilders="[ comma separated list of TreeBuilders specified as SystemObjects ]"
blankQueryReturnsAll="true|false(default)"
caseSensitive="[true(default)|false]"
nestedNodes="names of nested nodes to be added as nested results for search"
freeTextFields="[ comma separated list of fields to be searched as free text ]"
subNodesQuery="[ param=value pair that will cause result set to be expanded to include all sub nodes ]"
idField="[ (optional) name of result field that gets the TreeNode ID value (default='ID') ]"
nameField="[ (optional) name of result field that gets the TreeNode name value (default='name') ]"
pathField="[ (optional) name of result field that gets the TreeNode path value (default='path') ]" >
<!-- optional SearchFields tag to restrict search to specific fields -->
<SearchFields fieldOperator="AND|OR(default)" >
<!-- One or more Field elements -->
<Field ID="name" />
<Field ID="path" />
<Field ID="[ custom field ]" exactMatch="true" />
<!-- Can have one field designated as a FreeText field -->
<Field ID="[ free text search field ]" freeText="true" />
<!-- etc. . . -->
</SearchFields>
<!-- One or more TreeBuilders -->
<TreeBuilder class="[implementation of ITreeBuilder]" >
<!-- TreeBuilder specific configuration details -->
</TreeBuilder>
<TreeBuilder class="[ another ITreeBuilder ]" >
</TreeBuilder>
<!-- etc. . . >
</SourceType>
Developed by
Raritan Technologies Inc..
- Author:
- Ted Sullivan
|
Method Summary |
void |
addTree(TreeRoot tree)
|
void |
addTreeBuilder(ITreeBuilder treeBuilder)
Adds a TreeBuilder... |
void |
addTreeBuilder(java.lang.String treeBuilderName)
|
static BasicResult |
createResult(TreeNode tn,
java.lang.String idField,
java.lang.String nameField,
java.lang.String pathField,
java.lang.String pathSeparator,
boolean includeInitSeparator)
|
static BasicResult |
createResult(TreeNode tn,
java.lang.String idField,
java.lang.String nameField,
java.lang.String pathField,
java.lang.String pathSeparator,
java.lang.String parentNameField,
java.lang.String childNameField,
boolean includeInitSeparator)
|
SearchSource[] |
createSearchSources(org.w3c.dom.Element sourceElem,
ISearchFieldMapFactory factory)
|
IResultSet |
executeQuery(java.lang.Integer queryID,
ISearchFieldMap searchMap,
SourceLoginInfo[] sources,
OrderedMap inputParameters,
java.lang.Integer pageSize,
java.lang.Integer startRec)
Executes a Query. |
IQueryProcessor |
getQueryProcessor()
returns the type of QueryProcessor that can access this SearchSource. |
java.util.List |
getTreeNodes(IResultSet searchResults)
|
void |
initializeSource(org.w3c.dom.Element sourceElem,
SearchSource source)
|
void |
setCaseSensitive(boolean caseSensitive)
|
void |
setFieldOperator(java.lang.String fieldOperator)
|
| Methods inherited from class com.raritantechnologies.searchApp.SearchSource |
addFieldFormatter, addSearchField, addSourceAttributes, addStaticField, addStaticFields, addUserSearchField, canAccess, canConsolidateSources, consolidateSources, delSearchField, formatResult, formatResult, formatResultField, formatResultField, formatResults, formatResults, getAccessableFields, getAttributes, getBasePath, getConfigPath, getDisplayName, getFieldFormatters, getIDField, getName, getProperty, getSearchField, getSearchFieldID, getSearchFields, getSearchFields, getSecondarySortSpec, getSecurityManager, getSecurityManagerName, getSecurityModel, getSortSpec, getSourceCredentials, getSourcePropertyNames, getTitleField, getType, getURLField, getUserSearchFields, isMultiThreaded, setConfigPath, setDisplayName, setIDField, setMultiThreaded, setName, setSecurityManagerName, setSecurityModel, setSortMap, setSourcePropertyInfoSource, setTitleField, setType, setURLField, shouldFormatResults, supportsBackgroundSort |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TreeSearchSource
public TreeSearchSource()
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
setFieldOperator
public void setFieldOperator(java.lang.String fieldOperator)
addTreeBuilder
public void addTreeBuilder(ITreeBuilder treeBuilder)
- Adds a TreeBuilder...
addTreeBuilder
public void addTreeBuilder(java.lang.String treeBuilderName)
addTree
public void addTree(TreeRoot tree)
getQueryProcessor
public IQueryProcessor getQueryProcessor()
- Description copied from class:
SearchSource
- returns the type of QueryProcessor that can access this SearchSource.
- Specified by:
getQueryProcessor in class SearchSource
executeQuery
public IResultSet executeQuery(java.lang.Integer queryID,
ISearchFieldMap searchMap,
SourceLoginInfo[] sources,
OrderedMap inputParameters,
java.lang.Integer pageSize,
java.lang.Integer startRec)
throws QueryProcessorException
- Description copied from interface:
IQueryProcessor
- Executes a Query. Returns results in the form of an IResultSet object.
- Specified by:
executeQuery in interface IQueryProcessor
- Parameters:
queryID - Unique ID for this query. Used by front end to manage queries and
query pages. QueryProcessor may use this parameter to organize its search results, and
to organize any state information it needs to process future page requests
(future executeQuery( ) calls with the same queryID.searchMap - Provides mapping information needed to translate the inputParameters
into a search string appropriate for this type of QueryProcessor.
Mapping information is obtained by the application framework from
local configuration data.sources - The LoginInfo and SearchSource(s) to be used for this query. The SearchSource(s)
must be of the appropriate type for the QueryProcessor.inputParameters - Form inputs. Use ISearchFieldMap to translate these into
implementation and source-specific fields.pageSize - Integer specifying the number of results to include in the returned
Document.
if null - use the default page size.startRec - Integer specifying the starting record in the result set to be returned.
if null - start with the first record.
- Returns:
- IResultSet containing result set.
- Throws:
QueryProcessorException
getTreeNodes
public java.util.List getTreeNodes(IResultSet searchResults)
createSearchSources
public SearchSource[] createSearchSources(org.w3c.dom.Element sourceElem,
ISearchFieldMapFactory factory)
- Specified by:
createSearchSources in interface IXMLSearchSourceFactory
initializeSource
public void initializeSource(org.w3c.dom.Element sourceElem,
SearchSource source)
- Specified by:
initializeSource in interface IXMLSearchSourceFactory
createResult
public static BasicResult createResult(TreeNode tn,
java.lang.String idField,
java.lang.String nameField,
java.lang.String pathField,
java.lang.String pathSeparator,
boolean includeInitSeparator)
createResult
public static BasicResult createResult(TreeNode tn,
java.lang.String idField,
java.lang.String nameField,
java.lang.String pathField,
java.lang.String pathSeparator,
java.lang.String parentNameField,
java.lang.String childNameField,
boolean includeInitSeparator)