wt.query
Class DatabaseSearch

java.lang.Object
  extended bywt.query.DatabaseSearch
All Implemented Interfaces:
Externalizable, Serializable

public class DatabaseSearch
extends Object
implements Externalizable

Utility class for processing the database search part of the integrated search.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private static String AND
           
private static String CLASSNAME
           
(package private)  Vector classnames
           
(package private)  Hashtable criteria
           
(package private)  Vector displayAttributes
           
private  boolean domainRefSearch
           
static long EXTERNALIZATION_VERSION_UID
           
private  boolean hasIterationInfo
           
private  boolean isChangeObject
           
(package private)  Locale locale
           
protected static long OLD_FORMAT_VERSION_UID
           
private  int openParenPosition
           
private static String OR
           
private  boolean orSearch
           
private static String RESOURCE
           
(package private)  String searchFilter
           
(package private) static long serialVersionUID
           
(package private)  Vector sortKeys
           
private static boolean VERBOSE
           
private static char WILDCARD_ESCAPE
           
 
Constructor Summary
private DatabaseSearch(Vector classnames, Hashtable criteria, Vector displayAttributes, Vector sortKeys, String searchFilter, Locale locale)
          Create and populate an instance that can be used to build and execute the database part of the integrated search.
 
Method Summary
private  QuerySpec addConfigSpec(Class classname, QuerySpec qs, String searchFilter)
           
private  QuerySpec addToWhere(QuerySpec qs, SearchCondition sc)
           
private  QuerySpec addToWhere(QuerySpec qs, SearchCondition sc, String logicalOperator)
           
private  QuerySpec appendOidList(Class classname, int index, Vector oid_arrays)
          Append the oids list from the content search into the database search.
static PagingQueryResult databaseSearch(Vector classnames, Hashtable criteria, Vector displayAttributes, Vector sortKeys, int pageOffset, int pageRange, String searchFilter, HashMap oidList, Locale locale)
          Does the database part of the integrated search.
private  PagingQueryResult execute(Vector query_specs, int pageOffset, int pageRange)
          After the entire set of query specs is built this method can be used to run the search.
private  SearchCondition getSearchCondition(Class classname, ClassInfo class_info, String attrib_name, String value, Locale locale)
           
private  QuerySpec initQuerySpec(Class one_class)
           
private  boolean isEnumType(Class type)
           
static PagingQueryResult limitedDatabaseSearch(Vector classnames, Hashtable criteria, Vector displayAttributes, Vector sortKeys, int pageOffset, int pageRange, String searchFilter, HashMap oidList, Locale locale)
          Does the database part of the limited integrated search.
private  QuerySpec limitedPopulateQuerySpec(Class classname, QuerySpec qs)
          Use all of the information that has been set on this class to populate the QuerySpec(s).
private  QuerySpec populateQuerySpec(Class classname, QuerySpec qs)
          Use all of the information that has been set on this class to populate the QuerySpec(s).
private  Vector processOids(HashMap oidList)
          Condense oids list from the content search into the correct classes for the database search.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(DatabaseSearch thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

classnames

Vector classnames

criteria

Hashtable criteria

displayAttributes

Vector displayAttributes

sortKeys

Vector sortKeys

searchFilter

String searchFilter

locale

Locale locale

OR

private static final String OR
See Also:
Constant Field Values

AND

private static final String AND
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE

WILDCARD_ESCAPE

private static final char WILDCARD_ESCAPE

domainRefSearch

private boolean domainRefSearch

orSearch

private boolean orSearch

openParenPosition

private int openParenPosition

hasIterationInfo

private boolean hasIterationInfo

isChangeObject

private boolean isChangeObject
Constructor Detail

DatabaseSearch

private DatabaseSearch(Vector classnames,
                       Hashtable criteria,
                       Vector displayAttributes,
                       Vector sortKeys,
                       String searchFilter,
                       Locale locale)
Create and populate an instance that can be used to build and execute the database part of the integrated search.

Parameters:
classnames - A list of the classes (of type Class not String) that this search will use in a compound search. All of the criteria attributes and the sorting attributes must be the same for each of the classes in the list. The sorting must be in the same order and the types of the attributes must be the same.
criteria - A series of name value pairs of type String that specify the search criteria.
displayAttributes - List of attributes that are used to inflate the attribute values after a search or retrieval of a page.
sortKeys - List of sort key strings that the results should be sorted in. The keys are ordered with the first sort key being the first in the list. The string is of the format: : Where attribute name is the name of the column to be sorted on and descending is a boolean that specifies true for descending and false for ascending order. False is the default if no value is specified.
searchFilter - Can be set to either ALL_VERSIONS or ALL_ITERATIONS. The ALL_VERSIONS will return the latest iteration of each of the versions for the iterated object. ALL_ITERATIONS will return all iterations of all versions of the iterated object.
locale - Locale of the client that is executed this method.
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(DatabaseSearch thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

databaseSearch

public static PagingQueryResult databaseSearch(Vector classnames,
                                               Hashtable criteria,
                                               Vector displayAttributes,
                                               Vector sortKeys,
                                               int pageOffset,
                                               int pageRange,
                                               String searchFilter,
                                               HashMap oidList,
                                               Locale locale)
                                        throws WTException
Does the database part of the integrated search. Uses the oid list to retrict the search to what was found by the content search. If the oid list is null then this search will do just the database search.

Supported API: true

Parameters:
classnames - A list of the classes (of type Class not String) that this search will use in a compound search. All of the criteria attributes and the sorting attributes must be the same for each of the classes in the list. The sorting must be in the same order and the types of the attributes must be the same.
criteria - A series of name value pairs of type String that specify the search criteria.
displayAttributes - List of attributes that are used to inflate the attribute values after a search or retrieval of a page.
sortKeys - List of sort key strings that the results should be sorted in. The keys are ordered with the first sort key being the first in the list. The string is of the format: : Where attribute name is the name of the column to be sorted on and descending is a boolean that specifies true for descending and false for ascending order. False is the default if no value is specified.
pageOffset - For the database paging of the search results this is the page offset into the results that is being requested. If the session id has been set to a valid session then a new query is not done but the offset is used to return a specific page of the query results. The first page is 0.
pageRange - For the database paging of the search results this sets the size of a page.
searchFilter - Can be set to either ALL_VERSIONS or ALL_ITERATIONS. The ALL_VERSIONS will return the latest iteration of each of the versions for the iterated object. ALL_ITERATIONS will return all iterations of all versions of the iterated object.
oidList -
locale - Locale of the client that is executed this method.
Returns:
PagingQueryResult
Throws:
WTException

limitedDatabaseSearch

public static PagingQueryResult limitedDatabaseSearch(Vector classnames,
                                                      Hashtable criteria,
                                                      Vector displayAttributes,
                                                      Vector sortKeys,
                                                      int pageOffset,
                                                      int pageRange,
                                                      String searchFilter,
                                                      HashMap oidList,
                                                      Locale locale)
                                               throws WTException
Does the database part of the limited integrated search. Uses the oid list to retrict the search to what was found by the content search. If the oid list is null then this search will do just the database search.

Supported API: true

Parameters:
classnames - A list of the classes (of type Class not String) that this search will use in a compound search. All of the criteria attributes and the sorting attributes must be the same for each of the classes in the list. The sorting must be in the same order and the types of the attributes must be the same.
criteria - A series of name value pairs of type String that specify the search criteria.
displayAttributes - List of attributes that are used to inflate the attribute values after a search or retrieval of a page.
sortKeys - List of sort key strings that the results should be sorted in. The keys are ordered with the first sort key being the first in the list. The string is of the format: : Where attribute name is the name of the column to be sorted on and descending is a boolean that specifies true for descending and false for ascending order. False is the default if no value is specified.
pageOffset - For the database paging of the search results this is the page offset into the results that is being requested. If the session id has been set to a valid session then a new query is not done but the offset is used to return a specific page of the query results. The first page is 0.
pageRange - For the database paging of the search results this sets the size of a page.
searchFilter - Can be set to either ALL_VERSIONS or ALL_ITERATIONS. The ALL_VERSIONS will return the latest iteration of each of the versions for the iterated object. ALL_ITERATIONS will return all iterations of all versions of the iterated object.
oidList -
locale - Locale of the client that is executed this method.
Returns:
PagingQueryResult
Throws:
WTException

processOids

private Vector processOids(HashMap oidList)
                    throws WTException
Condense oids list from the content search into the correct classes for the database search.

Parameters:
oidList - Structure of oids returned from the content search engine.
Throws:
WTException

appendOidList

private QuerySpec appendOidList(Class classname,
                                int index,
                                Vector oid_arrays)
                         throws WTException
Append the oids list from the content search into the database search.

Throws:
WTException

execute

private PagingQueryResult execute(Vector query_specs,
                                  int pageOffset,
                                  int pageRange)
                           throws WTException
After the entire set of query specs is built this method can be used to run the search.

Parameters:
pageOffset - For the database paging of the search results this is the page offset into the results that is being requested. If the session id has been set to a valid session then a new query is not done but the offset is used to return a specific page of the query results. The first page is 0.
pageRange - For the database paging of the search results this sets the size of a page.
Returns:
PagingQueryResult
Throws:
WTException

populateQuerySpec

private QuerySpec populateQuerySpec(Class classname,
                                    QuerySpec qs)
                             throws WTException
Use all of the information that has been set on this class to populate the QuerySpec(s).

Throws:
WTException

limitedPopulateQuerySpec

private QuerySpec limitedPopulateQuerySpec(Class classname,
                                           QuerySpec qs)
                                    throws WTException
Use all of the information that has been set on this class to populate the QuerySpec(s).

Throws:
WTException

initQuerySpec

private QuerySpec initQuerySpec(Class one_class)
                         throws WTException
Throws:
WTException

addToWhere

private QuerySpec addToWhere(QuerySpec qs,
                             SearchCondition sc)
                      throws QueryException
Throws:
QueryException

addToWhere

private QuerySpec addToWhere(QuerySpec qs,
                             SearchCondition sc,
                             String logicalOperator)
                      throws QueryException
Throws:
QueryException

addConfigSpec

private QuerySpec addConfigSpec(Class classname,
                                QuerySpec qs,
                                String searchFilter)
                         throws WTException
Throws:
WTException

isEnumType

private boolean isEnumType(Class type)

getSearchCondition

private SearchCondition getSearchCondition(Class classname,
                                           ClassInfo class_info,
                                           String attrib_name,
                                           String value,
                                           Locale locale)
                                    throws WTException
Throws:
WTException