wt.query
Class QuerySpec

java.lang.Object
  extended bywt.query.QuerySpec
All Implemented Interfaces:
Cloneable, Externalizable, Serializable, StatementSpec
Direct Known Subclasses:
NavigateSpec

public class QuerySpec
extends Object
implements Cloneable, StatementSpec, Externalizable

This class represents a Query in terms of Windchill objects. The Query is constructed in terms of classes, search condtions, etc. When used by the PersistenceManager, this class constructs a SQL query statement based on its current property values.

Note that this implementation is not synchronized. If mulitple threads modify or execute the same instance, then access must be synchronized externally. Alternatively, a copy of the instance could be made via the clone() method so that each thread accesses its own instance.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
private  boolean advancedQueryEnabled
           
private  boolean aggregateSelect
           
private static String CLASSNAME
           
private  List correlatedClassAttributes
           
private  boolean distinct
           
static long EXTERNALIZATION_VERSION_UID
           
private  FromClause fromClause
           
private  GroupByClause groupByClause
           
private  ConditionsClause havingClause
           
private  Vector hintsVector
           
private  int[] joinOrder
           
static int LINK_FROM_INDEX
          Link class from index.
private  boolean lock
           
private static String OID_CLASSNAME
           
private static String OID_ID
           
protected static long OLD_FORMAT_VERSION_UID
           
private  OrderByClause orderByClause
           
private  boolean querySet
           
private static String RESOURCE
           
private  SequentialResultBuilder resultBuilder
           
private  ResultCursor resultCursor
           
private  Vector selectList
           
(package private) static long serialVersionUID
           
private  QuerySpecStatementBuilder statementBuilder
           
private static boolean USE_BIND_DEFAULT
          Default useBind value.
private  boolean useBind
           
private  WhereClause whereClause
           
 
Fields inherited from interface wt.pds.StatementSpec
ADVANCED_QUERY, ADVANCED_QUERY_ENABLED, AGGREGATE_SELECT, CORRELATED_CLASS_ATTRIBUTES, FETCH_SIZE, PRIMARY_CLASS, QUERY_LIMIT, RESULT_BUILDER, RESULT_CURSOR, SINGLE_RESULT_COMPATIBLE, STATEMENT_BUILDER, USE_BIND
 
Constructor Summary
  QuerySpec()
          Create the specification object.
protected QuerySpec(boolean a_initialize)
           
  QuerySpec(Class queryClass)
          Create the specification object and identify the base class to be searched.
  QuerySpec(Class[] queryClasses)
          Deprecated. as of R6.0, use QuerySpec() and appendClassList(Class, boolean)
  QuerySpec(Class baseClass1, Class baseClass2)
          Create the specification object and identify the base classes to be searched.
  QuerySpec(Class targetClass, Class linkClass, QuerySpec a_querySpec)
          Deprecated. as of X05, use NavigateSpec(QuerySpec,String,Persistable)
  QuerySpec(String queryClassname)
          Deprecated. as of R6.0, use QuerySpec(Class)
 
Method Summary
 int addClassList(Class newClass, boolean isSelectable)
          Adds the class to the class list.
 void appendAnd()
          Add an AND operator to the where clause.
 int appendClassList(Class newClass, boolean isSelectable)
          Appends a new class to the class list.
 void appendCloseParen()
          Add a closing parenthesis to the where clause.
 void appendCondition(WhereCondition a_condition)
          Appends a condition to the query.
protected  void appendCorrelatedClassAttributes(ClassAttribute a_classAttribute)
          

Supported API: false
 int appendFrom(TableExpression a_tableExpression)
          Appends a Table Expression to the From clause.
 void appendGroupBy(ColumnExpression a_column, int[] a_fromIndicies, boolean a_appendSelect)
          Appends the column expression to the GROUP BY clause.
 void appendGroupBy(ColumnExpression a_column, int a_fromIndex, boolean a_appendSelect)
          Deprecated. at R6, Use appendGroupBy(ColumnExpression, int[], boolean)
 void appendHaving(WhereExpression a_where, int[] a_fromIndicies)
          Appends the where expression to the HAVING clause.
 void appendHint(String a_hint)
          This method appends a datastore specific query optimization hint.
 void appendJoin(int a_linkIndex, String a_role, int a_targetIndex)
          Appends a join condition for the link class specified by the link index to the target class specified by the target index for the role.
 void appendJoin(int a_linkIndex, String a_role, Persistable a_source)
          Appends a join condition for the link class specified by the link index to the source object for the role.
 void appendNot()
          Add a NOT operator to the where clause.
 void appendOpenParen()
          Add an opening parenthesis to the where clause.
 void appendOr()
          Add an OR operator to the where clause.
 void appendOrderBy(Class targetClass, String attrName, boolean descending)
          Deprecated. Replaced by appendOrderBy(OrderBy, int[])
 void appendOrderBy(Class targetClass, String attrName, boolean descending, SQLFunction sqlfunction)
          Deprecated. Replaced by appendOrderBy(OrderBy, int[])
 void appendOrderBy(OrderBy a_orderBy)
          Deprecated. Replaced by appendOrderBy(OrderBy, int[])
 void appendOrderBy(OrderBy a_orderBy, int a_classIndex)
          Deprecated. at R6, Replaced by appendOrderBy(OrderBy, int[])
 void appendOrderBy(OrderBy a_orderBy, int[] a_fromIndicies)
          This method appends the OrderBy expression to the OrderBy clause of the query.
 void appendRowNumCondition(int rowNum)
          Deprecated. Replaced by appendWhere(WhereExpression). Create the WhereExpression as follows:
 new SearchCondition(
       KeywordExpression.ROWNUM, 
       SearchCondition.LESS_THAN, 
       new ConstantExpression(new Integer(rowNum)))
 
 void appendSearchCondition(SearchCondition aSearchCondition)
          Deprecated. Replaced by appendWhere(WhereExpression, int[])
 void appendSearchCondition(SearchCondition aSearchCondition, int position, int joinPosition)
          Deprecated. Replaced by appendWhere(WhereExpression, int, int)
 void appendSelect(ColumnExpression a_column, boolean a_selectOnly)
          Appends the column expression to the select clause.
 void appendSelect(ColumnExpression a_column, int[] a_fromIndicies, boolean a_selectOnly)
          Appends the column expression to the select clause.
 void appendSelect(ColumnExpression a_column, int a_fromIndex, boolean a_selectOnly)
          Deprecated. as of R6.0, use appendSelect(ColumnExpression, int[], boolean)
(package private)  void appendSelect(ItemBuilder a_itemBuilder)
          Appends the ItemBuilder to the select.
 void appendSelectAttribute(String a_attributeName, int a_classIndex, boolean a_selectOnly)
          Appends the class attribute to the select clause.
 void appendSelectReference(ColumnExpression a_className, ColumnExpression a_id, int a_classNameFromIndex, int a_idFromIndex)
          Deprecated. Use appendSelectReference(ColumnExpression, ColumnExpression, int, int, boolean)
 void appendSelectReference(ColumnExpression a_className, ColumnExpression a_id, int a_classNameFromIndex, int a_idFromIndex, boolean a_fullObject)
          Appends the class reference to the select clause.
 void appendSelectReference(String a_attributeName, int a_classIndex)
          Deprecated. Use appendSelectReference(String, int, boolean)
 void appendSelectReference(String a_attributeName, int a_classIndex, boolean a_fullObject)
          Appends the class reference to the select clause.
 void appendWhere(WhereExpression a_whereExpression)
          Deprecated. As of 6.0, use appendWhere(WhereExpression, int[])
 void appendWhere(WhereExpression a_whereExpression, int a_fromIndex)
          Deprecated. As of 7.0, use appendWhere(WhereExpression, int[])
 void appendWhere(WhereExpression a_whereExpression, int[] a_fromIndicies)
          Appends an expression to the WHERE clause.
 void appendWhere(WhereExpression a_whereExpression, int a_fromIndex1, int a_fromIndex2)
          Deprecated. As of 7.0, use appendWhere(WhereExpression, int[])
 void appendWhere(WhereExpression a_whereExpression, TableExpression[] a_tableExpressions, String[] a_aliases)
          Appends an expression to the WHERE clause.
private  int[] buildIndicies(int a_fromCount, int a_fromIndex)
          Returns required indicies.
private  void checkPersistable(Class queryClass)
           
 Object clone()
          Create a deep-copy of this object.
protected static void clone(QuerySpec clone, QuerySpec original, boolean a_includeStatementBuilder)
          Create a deep-copy of this object.
 Object getBindParameterAt(int a_index)
          Returns the bind parameter value at the specified offset.
 int getBindParameterCount()
          Gets the value of the attribute: bindParameterCount; Indicates the number bind parameters for this Query.
 Class getClassAt(int position)
          Returns the class at the specified position in the class list.
 int getConditionCount()
          Gets the value of the attribute: conditionCount; Indicates the number of search conditions appended to this Query.
 List getCorrelatedClassAttributes()
          Gets the value of the attribute: correlatedClassAttributes.
 int getDepthThreshold()
          Gets the value of the attribute: depthThreshold; Threshold value for the number of subclass combinations.
 int getFetchSize()
          Gets the value of the attribute: fetchSize; A hint as to the number of rows that should be fetched from the database when more rows are needed.
 FromClause getFromClause()
          Gets the object for the association that plays role: fromClause.
private  void getFromString(StringBuffer s)
           
 String getGroupBy()
          Gets the value of the attribute: groupBy.
 GroupByClause getGroupByClause()
          Gets the object for the association that plays role: groupByClause.
 ConditionsClause getHavingClause()
          Gets the object for the association that plays role: havingClause.
 Vector getHintsVector()
          Gets the value of the attribute: hintsVector; This is a String Vector with each element as a hint.
 int[] getJoinOrder()
          Gets the value of the attribute: joinOrder; This int array indicate the join order by the array index and the element is the from index for the specified table.
 String getOrderBy()
          Gets the value of the attribute: orderBy.
 OrderByClause getOrderByClause()
          Gets the object for the association that plays role: orderByClause.
 Class getPrimaryClass()
          Gets the value of the attribute: primaryClass; Primary class for the query.
 int getQueryLimit()
          Gets the value of the attribute: queryLimit.
 ResultBuilder getResultBuilder()
          Gets the object for the association that plays role: resultBuilder.
 ResultCursor getResultCursor()
          Gets the object for the association that plays role: resultCursor.
 int getResultIndex(int a_classIndex)
          Returns the result index for the class index based on the current selectable settings of the class list.
 int[] getResultIndicies()
          Returns an array of result indecies for every class in the class list based on the current selectable settings.
 boolean getSelect(int position)
          Returns the selectable property for the specified position in the class list.
private  void getSelectString(StringBuffer s)
           
 StatementBuilder getStatementBuilder()
          Gets the object for the association that plays role: statementBuilder.
 String getWhere()
          Gets the value of the attribute: where.
 WhereClause getWhereClause()
          Gets the object for the association that plays role: whereClause.
protected  void initialize(Class[] queryClasses, QuerySpecStatementBuilder a_statementBuilder)
           
 boolean isAdvancedQuery()
          Gets the value of the attribute: advancedQuery; Indicates if the statement uses advanced query capabilities.
 boolean isAdvancedQueryEnabled()
          Gets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.
 boolean isAggregateSelect()
          Gets the value of the attribute: aggregateSelect.
 boolean isDistinct()
          Gets the value of the attribute: distinct; Indicates whether Query returns distinct results.
 boolean isLock()
          Gets the value of the attribute: lock.
 boolean isQuerySet()
          Gets the value of the attribute: querySet; Indicates whether QueryResult will contain single or multiple classes.
 boolean isSingleResultCompatible()
          Gets the value of the attribute: singleResultCompatible; Indicates if the query result should be returned as a single result (for backward compatibility)

Supported API: false
(package private) static boolean isTargetPersistable(ClassInfo aClassInfo)
           
 boolean isUseBind()
          Gets the value of the attribute: useBind; Indicates if bind parameters should be used when appending SearchConditions.
 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(QuerySpec thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setAdvancedQueryEnabled(boolean a_AdvancedQueryEnabled)
          Sets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.
 void setBindParameterAt(Object a_value, int a_index)
          

Supported API: false
 void setDepthThreshold(int a_DepthThreshold)
          Sets the value of the attribute: depthThreshold; Threshold value for the number of subclass combinations.
 void setDescendantQuery(boolean a_descendantQuery)
          This method sets descendeantsIncluded attribute of all TableExpressions currently in the query.
 void setDescendantsIncluded(boolean a_descendantsIncluded, int a_fromIndex)
          This method sets descendeantsIncluded attribute on the specified TableExpressions (if it currently exists in the query).
 void setDistinct(boolean a_Distinct)
          Sets the value of the attribute: distinct; Indicates whether Query returns distinct results.
 void setFetchSize(int a_FetchSize)
          Sets the value of the attribute: fetchSize; A hint as to the number of rows that should be fetched from the database when more rows are needed.
 void setJoinOrder(int[] a_JoinOrder)
          Sets the value of the attribute: joinOrder; This int array indicate the join order by the array index and the element is the from index for the specified table.
 void setJoinOrderAt(int a_fromIndex, int a_joinOrder)
          

Supported API: false
 void setLocale(Locale a_locale)
          Set the client locale.
 void setLock(boolean a_Lock)
          Sets the value of the attribute: lock.
 void setQueryLimit(int a_queryLimit)
          Set the query limit for the returned results from this query.
 void setQuerySet(boolean a_QuerySet)
          Sets the value of the attribute: querySet; Indicates whether QueryResult will contain single or multiple classes.
 void setSelect(int position, boolean isSelectable)
          Sets the selectable property for the specified position in the class list.
 void setUseBind(boolean a_UseBind)
          Sets the value of the attribute: useBind; Indicates if bind parameters should be used when appending SearchConditions.
 String toString()
          Answer a SQL Select statement defined by the Query spec
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

querySet

private boolean querySet

distinct

private boolean distinct

useBind

private boolean useBind

USE_BIND_DEFAULT

private static final boolean USE_BIND_DEFAULT
Default useBind value.


LINK_FROM_INDEX

public static final int LINK_FROM_INDEX
Link class from index.

Supported API: false

See Also:
Constant Field Values

advancedQueryEnabled

private transient boolean advancedQueryEnabled

aggregateSelect

private boolean aggregateSelect

correlatedClassAttributes

private List correlatedClassAttributes

joinOrder

private int[] joinOrder

hintsVector

private Vector hintsVector

lock

private boolean lock

selectList

private Vector selectList

whereClause

private WhereClause whereClause

statementBuilder

private QuerySpecStatementBuilder statementBuilder

resultBuilder

private SequentialResultBuilder resultBuilder

resultCursor

private ResultCursor resultCursor

fromClause

private FromClause fromClause

orderByClause

private OrderByClause orderByClause

groupByClause

private GroupByClause groupByClause

havingClause

private ConditionsClause havingClause

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

OID_CLASSNAME

private static final String OID_CLASSNAME
See Also:
Constant Field Values

OID_ID

private static final String OID_ID
See Also:
Constant Field Values
Constructor Detail

QuerySpec

public QuerySpec()
          throws QueryException
Create the specification object.

Supported API: true

Throws:
QueryException

QuerySpec

public QuerySpec(Class queryClass)
          throws QueryException
Create the specification object and identify the base class to be searched. Persistent subclasses will also be included in the search.

Supported API: true

Parameters:
queryClass - The class (plus it subclasses) being searched for persistent objects.
Throws:
QueryException - Occurs if the given class is not persistent.

QuerySpec

public QuerySpec(String queryClassname)
          throws QueryException
Deprecated. as of R6.0, use QuerySpec(Class)

Create the specification object and identify the base class to be searched. Persistent subclasses will also be included in the search.

Parameters:
queryClassname - The classname (plus it subclasses) being searched for persistent objects.
Throws:
QueryException - Occurs if the given class is not persistent.

QuerySpec

public QuerySpec(Class baseClass1,
                 Class baseClass2)
          throws QueryException
Create the specification object and identify the base classes to be searched. Persistent subclasses of each base class will also be included in the search.

Supported API: true

Parameters:
baseClass1 - first base class to be searched. If this QuerySpec is used as criteria for navigation, then this class is the target class of the navigation.
baseClass2 - second base class to be searched. If this QuerySpec is used as criteria for navigation, then this class is the link class of the navigation.
Throws:
QueryException - Occurs if the given class is not persistent.

QuerySpec

public QuerySpec(Class targetClass,
                 Class linkClass,
                 QuerySpec a_querySpec)
          throws QueryException
Deprecated. as of X05, use NavigateSpec(QuerySpec,String,Persistable)

Create the specification object and identify the target and link class to be searched. Persistent subclasses will also be included in the search. The specified QuerySpec must have identical or superclass target and link classes. Only the WHERE and ORDER BY clauses of the specified QuerySpec are used.

Supported API: false

Parameters:
targetClass -
linkClass -
a_querySpec - specifies a WHERE and ORDER BY clause to use for this query
Throws:
QueryException - Occurs if the given class is not persistent.

QuerySpec

public QuerySpec(Class[] queryClasses)
          throws QueryException
Deprecated. as of R6.0, use QuerySpec() and appendClassList(Class, boolean)

Create the specification object and identify the base classes to be searched. Persistent subclasses of each base class will also be included in the search.

Supported API: false

Parameters:
queryClasses - The classes (plus it subclasses) being searched for persistent objects.
Throws:
QueryException - Occurs if the given class is not persistent.

QuerySpec

protected QuerySpec(boolean a_initialize)
             throws QueryException
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(QuerySpec 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

isQuerySet

public boolean isQuerySet()
Gets the value of the attribute: querySet; Indicates whether QueryResult will contain single or multiple classes.

Supported API: false

Returns:
boolean

setQuerySet

public void setQuerySet(boolean a_QuerySet)
                 throws WTPropertyVetoException
Sets the value of the attribute: querySet; Indicates whether QueryResult will contain single or multiple classes.

Supported API: false

Parameters:
a_QuerySet -
Throws:
WTPropertyVetoException

isDistinct

public boolean isDistinct()
Gets the value of the attribute: distinct; Indicates whether Query returns distinct results. If true, the SQL DISTINCT is included in the select statement.

Supported API: true

Returns:
boolean

setDistinct

public void setDistinct(boolean a_Distinct)
                 throws WTPropertyVetoException
Sets the value of the attribute: distinct; Indicates whether Query returns distinct results. If true, the SQL DISTINCT is included in the select statement.

Supported API: true

Parameters:
a_Distinct -
Throws:
WTPropertyVetoException

getConditionCount

public int getConditionCount()
Gets the value of the attribute: conditionCount; Indicates the number of search conditions appended to this Query.

Supported API: true

Returns:
int

getWhere

public String getWhere()
                throws QueryException
Gets the value of the attribute: where.

Supported API: false

Returns:
String
Throws:
QueryException

getOrderBy

public String getOrderBy()
                  throws QueryException
Gets the value of the attribute: orderBy.

Supported API: false

Returns:
String
Throws:
QueryException

isUseBind

public boolean isUseBind()
Gets the value of the attribute: useBind; Indicates if bind parameters should be used when appending SearchConditions.

Supported API: true

Specified by:
isUseBind in interface StatementSpec
Returns:
boolean

setUseBind

public void setUseBind(boolean a_UseBind)
                throws WTPropertyVetoException
Sets the value of the attribute: useBind; Indicates if bind parameters should be used when appending SearchConditions.

Supported API: true

Specified by:
setUseBind in interface StatementSpec
Parameters:
a_UseBind -
Throws:
WTPropertyVetoException

getBindParameterCount

public int getBindParameterCount()
Gets the value of the attribute: bindParameterCount; Indicates the number bind parameters for this Query.

Supported API: true

Specified by:
getBindParameterCount in interface StatementSpec
Returns:
int

getDepthThreshold

public int getDepthThreshold()
Gets the value of the attribute: depthThreshold; Threshold value for the number of subclass combinations. Once this threshold is reached, a UNION statement is executed to determine which of the subclass combinations contains data that will need to be retrieved.

Supported API: true

Returns:
int

setDepthThreshold

public void setDepthThreshold(int a_DepthThreshold)
                       throws WTPropertyVetoException
Sets the value of the attribute: depthThreshold; Threshold value for the number of subclass combinations. Once this threshold is reached, a UNION statement is executed to determine which of the subclass combinations contains data that will need to be retrieved.

Supported API: true

Parameters:
a_DepthThreshold -
Throws:
WTPropertyVetoException

getGroupBy

public String getGroupBy()
                  throws QueryException
Gets the value of the attribute: groupBy.

Supported API: false

Returns:
String
Throws:
QueryException

isAdvancedQueryEnabled

public boolean isAdvancedQueryEnabled()
Gets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.

Supported API: true

Specified by:
isAdvancedQueryEnabled in interface StatementSpec
Returns:
boolean

setAdvancedQueryEnabled

public void setAdvancedQueryEnabled(boolean a_AdvancedQueryEnabled)
Sets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled.

Supported API: true

Specified by:
setAdvancedQueryEnabled in interface StatementSpec
Parameters:
a_AdvancedQueryEnabled -

isAggregateSelect

public boolean isAggregateSelect()
Gets the value of the attribute: aggregateSelect.

Supported API: false

Specified by:
isAggregateSelect in interface StatementSpec
Returns:
boolean

getCorrelatedClassAttributes

public List getCorrelatedClassAttributes()
Gets the value of the attribute: correlatedClassAttributes.

Supported API: false

Specified by:
getCorrelatedClassAttributes in interface StatementSpec
Returns:
List

getJoinOrder

public int[] getJoinOrder()
Gets the value of the attribute: joinOrder; This int array indicate the join order by the array index and the element is the from index for the specified table.

Supported API: false

Returns:
int[]

setJoinOrder

public void setJoinOrder(int[] a_JoinOrder)
Sets the value of the attribute: joinOrder; This int array indicate the join order by the array index and the element is the from index for the specified table.

Supported API: false

Parameters:
a_JoinOrder -

getHintsVector

public Vector getHintsVector()
Gets the value of the attribute: hintsVector; This is a String Vector with each element as a hint.

Supported API: false

Returns:
Vector

isLock

public boolean isLock()
Gets the value of the attribute: lock.

Supported API: false

Returns:
boolean

setLock

public void setLock(boolean a_Lock)
Sets the value of the attribute: lock.

Supported API: false

Parameters:
a_Lock -

getWhereClause

public WhereClause getWhereClause()
Gets the object for the association that plays role: whereClause.

Supported API: false

Returns:
WhereClause

getStatementBuilder

public StatementBuilder getStatementBuilder()
Gets the object for the association that plays role: statementBuilder.

Supported API: false

Specified by:
getStatementBuilder in interface StatementSpec
Returns:
StatementBuilder

getResultBuilder

public ResultBuilder getResultBuilder()
Gets the object for the association that plays role: resultBuilder.

Supported API: false

Specified by:
getResultBuilder in interface StatementSpec
Returns:
ResultBuilder

getResultCursor

public ResultCursor getResultCursor()
Gets the object for the association that plays role: resultCursor.

Supported API: false

Specified by:
getResultCursor in interface StatementSpec
Returns:
ResultCursor

getFromClause

public FromClause getFromClause()
Gets the object for the association that plays role: fromClause.

Supported API: true

Returns:
FromClause

getOrderByClause

public OrderByClause getOrderByClause()
Gets the object for the association that plays role: orderByClause.

Supported API: false

Returns:
OrderByClause

getGroupByClause

public GroupByClause getGroupByClause()
Gets the object for the association that plays role: groupByClause.

Supported API: false

Returns:
GroupByClause

getHavingClause

public ConditionsClause getHavingClause()
Gets the object for the association that plays role: havingClause.

Supported API: false

Returns:
ConditionsClause

getResultIndex

public int getResultIndex(int a_classIndex)
Returns the result index for the class index based on the current selectable settings of the class list. If the class index is not selectable, then -1 is returned. Note that this value can become invalid, if the selectable settings are modified.

Supported API: true

Parameters:
a_classIndex -
Returns:
int

getResultIndicies

public int[] getResultIndicies()
Returns an array of result indecies for every class in the class list based on the current selectable settings. If a class is not selectable, then -1 is returned in the associated array position. Note that these values can become invalid, if the selectable settings are modified.

Supported API: true

Returns:
int[]

appendOrderBy

public void appendOrderBy(OrderBy a_orderBy,
                          int a_classIndex)
                   throws QueryException
Deprecated. at R6, Replaced by appendOrderBy(OrderBy, int[])

This method appends the OrderBy expression to the OrderBy clause of the query. The index specifies the class associated with the expression.

Supported API: false

Parameters:
a_orderBy -
a_classIndex -
Throws:
QueryException

appendOrderBy

public void appendOrderBy(OrderBy a_orderBy)
                   throws QueryException
Deprecated. Replaced by appendOrderBy(OrderBy, int[])

This method appends the OrderBy expression to the OrderBy clause of the query. The OrderBy class index for the OrderBy expression is obtained by searching the query class list. Only the first matching class index is used. When the same class has been added multiple times, then the appendOrderBy method which specifies the index should be used.

Supported API: false

Parameters:
a_orderBy -
Throws:
QueryException

appendSelectAttribute

public void appendSelectAttribute(String a_attributeName,
                                  int a_classIndex,
                                  boolean a_selectOnly)
                           throws QueryException
Appends the class attribute to the select clause.

Supported API: true

Parameters:
a_attributeName -
a_classIndex -
a_selectOnly -
Throws:
QueryException

appendSelectReference

public void appendSelectReference(String a_attributeName,
                                  int a_classIndex)
                           throws QueryException
Deprecated. Use appendSelectReference(String, int, boolean)

Appends the class reference to the select clause.

Supported API: false

Parameters:
a_attributeName - Attribute name of the ObjectReference.
a_classIndex - Index in the From clause for the class that contains the ObjectReference attribute.
Throws:
QueryException

appendFrom

public int appendFrom(TableExpression a_tableExpression)
Appends a Table Expression to the From clause.

Supported API: true

Parameters:
a_tableExpression -
Returns:
int

appendSelect

public void appendSelect(ColumnExpression a_column,
                         int a_fromIndex,
                         boolean a_selectOnly)
                  throws QueryException
Deprecated. as of R6.0, use appendSelect(ColumnExpression, int[], boolean)

Appends the column expression to the select clause.

Supported API: false

Parameters:
a_column -
a_fromIndex -
a_selectOnly -
Throws:
QueryException

getBindParameterAt

public Object getBindParameterAt(int a_index)
Returns the bind parameter value at the specified offset.

Supported API: true

Parameters:
a_index -
Returns:
Object

appendWhere

public void appendWhere(WhereExpression a_whereExpression)
                 throws QueryException
Deprecated. As of 6.0, use appendWhere(WhereExpression, int[])

Appends an expression to the WHERE clause. This method internally uses the FROM index array { 0, 1} to append the expression. This may not be valid in some cases.

Supported API: false

Parameters:
a_whereExpression -
Throws:
QueryException

appendWhere

public void appendWhere(WhereExpression a_whereExpression,
                        int a_fromIndex)
                 throws QueryException
Deprecated. As of 7.0, use appendWhere(WhereExpression, int[])

Appends an expression to the WHERE clause.

Supported API: true

Parameters:
a_whereExpression -
a_fromIndex -
Throws:
QueryException

appendWhere

public void appendWhere(WhereExpression a_whereExpression,
                        int a_fromIndex1,
                        int a_fromIndex2)
                 throws QueryException
Deprecated. As of 7.0, use appendWhere(WhereExpression, int[])

Appends an expression to the WHERE clause.

Supported API: true

Parameters:
a_whereExpression -
a_fromIndex1 -
a_fromIndex2 -
Throws:
QueryException

appendWhere

public void appendWhere(WhereExpression a_whereExpression,
                        TableExpression[] a_tableExpressions,
                        String[] a_aliases)
                 throws QueryException
Appends an expression to the WHERE clause. This method explicitly uses the TableExpressions and aliases specified which may be from outer selects.

Supported API: true

Parameters:
a_whereExpression -
a_tableExpressions -
a_aliases -
Throws:
QueryException

appendSelect

public void appendSelect(ColumnExpression a_column,
                         boolean a_selectOnly)
                  throws QueryException
Appends the column expression to the select clause. Note that ColumnExpression will not have a table alias applied. If one is required, then appendSelect(ColumnExpression, int[], boolean) should be used.

Supported API: true

Parameters:
a_column -
a_selectOnly -
Throws:
QueryException

appendSelectReference

public void appendSelectReference(ColumnExpression a_className,
                                  ColumnExpression a_id,
                                  int a_classNameFromIndex,
                                  int a_idFromIndex)
                           throws QueryException
Deprecated. Use appendSelectReference(ColumnExpression, ColumnExpression, int, int, boolean)

Appends the class reference to the select clause. The specified ColumnExpressions must return a classname and id value in the result set.

Supported API: false

Parameters:
a_className - ColumnExpression of the ObjectReference class name.
a_id - ColumnExpression of the ObjectReference ID.
a_classNameFromIndex - Index in the From clause for the ColumnExpression of the ObjectReference class name.
a_idFromIndex - Index in the From clause for the ColumnExpression of the ObjectReference ID.
Throws:
QueryException

appendGroupBy

public void appendGroupBy(ColumnExpression a_column,
                          int a_fromIndex,
                          boolean a_appendSelect)
                   throws QueryException
Deprecated. at R6, Use appendGroupBy(ColumnExpression, int[], boolean)

Appends the column expression to the GROUP BY clause.

Supported API: false

Parameters:
a_column - object to append
a_fromIndex - Index in the FromClause for the TableExpression corresponding to the ColumnExpression
a_appendSelect - Indicates if the ColumnExpression should be appended to the SELECT clause also.
Throws:
QueryException

appendSelectReference

public void appendSelectReference(String a_attributeName,
                                  int a_classIndex,
                                  boolean a_fullObject)
                           throws QueryException
Appends the class reference to the select clause.

Supported API: true

Parameters:
a_attributeName - Attribute name of the ObjectReference.
a_classIndex - Index in the From clause for the class that contains the ObjectReference attribute.
a_fullObject - Indicates whether a full ObjectReference instance should be returned in the result set. This value should be false if this QuerySpec is to be used as the primary statement of a PageableQuerySpec.
Throws:
QueryException

appendSelectReference

public void appendSelectReference(ColumnExpression a_className,
                                  ColumnExpression a_id,
                                  int a_classNameFromIndex,
                                  int a_idFromIndex,
                                  boolean a_fullObject)
                           throws QueryException
Appends the class reference to the select clause. The specified ColumnExpressions must return a classname and id value in the result set.

Supported API: true

Parameters:
a_className - ColumnExpression of the ObjectReference class name.
a_id - ColumnExpression of the ObjectReference ID.
a_classNameFromIndex - Index in the From clause for the ColumnExpression of the ObjectReference class name.
a_idFromIndex - Index in the From clause for the ColumnExpression of the ObjectReference ID.
a_fullObject - Indicates whether a full ObjectReference instance should be returned in the result set. This value should be false if this QuerySpec is to be used as the primary statement of a PageableQuerySpec.
Throws:
QueryException

appendWhere

public void appendWhere(WhereExpression a_whereExpression,
                        int[] a_fromIndicies)
                 throws QueryException
Appends an expression to the WHERE clause. This method uses the specified indicies to reference TableExpressions and aliases in the FromClause.

Supported API: true

Parameters:
a_whereExpression -
a_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpressions in the WhereExpression
Throws:
QueryException

appendSelect

public void appendSelect(ColumnExpression a_column,
                         int[] a_fromIndicies,
                         boolean a_selectOnly)
                  throws QueryException
Appends the column expression to the select clause.

Supported API: true

Parameters:
a_column - ColumnExpression to append to the query SELECT clause.
a_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpression
a_selectOnly - Indicates if the appended ColumnExpression should be added to the SELECT clause only. If true, then the value associated with this ColumnExpression will not be returned in the query results.
Throws:
QueryException

appendOrderBy

public void appendOrderBy(OrderBy a_orderBy,
                          int[] a_fromIndicies)
                   throws QueryException
This method appends the OrderBy expression to the OrderBy clause of the query. The indicies specifies the association of the from clause items with the expression.

Supported API: true

Parameters:
a_orderBy - OrderBy expression to append
a_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpression in the OrderBy
Throws:
QueryException

appendGroupBy

public void appendGroupBy(ColumnExpression a_column,
                          int[] a_fromIndicies,
                          boolean a_appendSelect)
                   throws QueryException
Appends the column expression to the GROUP BY clause.

Supported API: true

Parameters:
a_column - object to append
a_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpression
a_appendSelect - Indicates if the ColumnExpression should be appended to the SELECT clause also.
Throws:
QueryException

appendJoin

public void appendJoin(int a_linkIndex,
                       String a_role,
                       Persistable a_source)
                throws WTException
Appends a join condition for the link class specified by the link index to the source object for the role.

Supported API: true

Parameters:
a_linkIndex - Index of the link class in this QuerySpec
a_role - The role on the link association
a_source - The Persistable instance to join the link to
Throws:
WTException

appendJoin

public void appendJoin(int a_linkIndex,
                       String a_role,
                       int a_targetIndex)
                throws WTException
Appends a join condition for the link class specified by the link index to the target class specified by the target index for the role.

Supported API: true

Parameters:
a_linkIndex - Index of the link class in this QuerySpec
a_role - The role on the link association
a_targetIndex - The index of the target class to join the link to
Throws:
WTException

setDescendantQuery

public void setDescendantQuery(boolean a_descendantQuery)
                        throws WTPropertyVetoException
This method sets descendeantsIncluded attribute of all TableExpressions currently in the query. Any TableExpressions added after this method is invoked will not be affected.

Supported API: false

Parameters:
a_descendantQuery -
Throws:
WTPropertyVetoException

setDescendantsIncluded

public void setDescendantsIncluded(boolean a_descendantsIncluded,
                                   int a_fromIndex)
                            throws WTPropertyVetoException
This method sets descendeantsIncluded attribute on the specified TableExpressions (if it currently exists in the query). Any TableExpressions added after this method is invoked will not be affected.

Supported API: false

Parameters:
a_descendantsIncluded -
a_fromIndex -
Throws:
WTPropertyVetoException

appendCorrelatedClassAttributes

protected void appendCorrelatedClassAttributes(ClassAttribute a_classAttribute)


Supported API: false

Parameters:
a_classAttribute -

appendHint

public void appendHint(String a_hint)
                throws QueryException
This method appends a datastore specific query optimization hint.

Supported API: true

Parameters:
a_hint - This is the hint which will be specified.
Throws:
QueryException

setJoinOrderAt

public void setJoinOrderAt(int a_fromIndex,
                           int a_joinOrder)


Supported API: false

Parameters:
a_fromIndex - The from index for the table which will be set for the join order.
a_joinOrder - This int value indicate the join order for the table specified by its from index, and the value starts with zero.

appendHaving

public void appendHaving(WhereExpression a_where,
                         int[] a_fromIndicies)
                  throws QueryException
Appends the where expression to the HAVING clause.

Supported API: true

Parameters:
a_where - object to append
a_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpressions in the WhereExpression
Throws:
QueryException

getPrimaryClass

public Class getPrimaryClass()
Gets the value of the attribute: primaryClass; Primary class for the query.

Supported API: false

Specified by:
getPrimaryClass in interface StatementSpec
Returns:
Class

isSingleResultCompatible

public boolean isSingleResultCompatible()
Gets the value of the attribute: singleResultCompatible; Indicates if the query result should be returned as a single result (for backward compatibility)

Supported API: false

Specified by:
isSingleResultCompatible in interface StatementSpec
Returns:
boolean

getQueryLimit

public int getQueryLimit()
Gets the value of the attribute: queryLimit.

Supported API: false

Specified by:
getQueryLimit in interface StatementSpec
Returns:
int

isAdvancedQuery

public boolean isAdvancedQuery()
                        throws WTException
Gets the value of the attribute: advancedQuery; Indicates if the statement uses advanced query capabilities.

Supported API: false

Specified by:
isAdvancedQuery in interface StatementSpec
Returns:
boolean
Throws:
WTException

getFetchSize

public int getFetchSize()
Gets the value of the attribute: fetchSize; A hint as to the number of rows that should be fetched from the database when more rows are needed.

Supported API: false

Specified by:
getFetchSize in interface StatementSpec
Returns:
int

setFetchSize

public void setFetchSize(int a_FetchSize)
                  throws WTPropertyVetoException
Sets the value of the attribute: fetchSize; A hint as to the number of rows that should be fetched from the database when more rows are needed.

Supported API: false

Specified by:
setFetchSize in interface StatementSpec
Parameters:
a_FetchSize -
Throws:
WTPropertyVetoException

setLocale

public void setLocale(Locale a_locale)
               throws WTException
Set the client locale.

Supported API: true

Specified by:
setLocale in interface StatementSpec
Parameters:
a_locale -
Throws:
WTException

setBindParameterAt

public void setBindParameterAt(Object a_value,
                               int a_index)


Supported API: false

Specified by:
setBindParameterAt in interface StatementSpec
Parameters:
a_value -
a_index -

appendCondition

public void appendCondition(WhereCondition a_condition)
                     throws WTException
Appends a condition to the query.

Supported API: false

Parameters:
a_condition - Condition to append
Throws:
WTException

getClassAt

public Class getClassAt(int position)
                 throws QueryException
Returns the class at the specified position in the class list.

Parameters:
position - class list position
Returns:
Class in the class list
Throws:
QueryException - if an invalid position is specified

appendClassList

public int appendClassList(Class newClass,
                           boolean isSelectable)
                    throws QueryException
Appends a new class to the class list.

Supported API: true

Parameters:
newClass - class to append
isSelectable - indicates if the class is included in the SELECT
Returns:
int position in the class list where this class was appended
Throws:
QueryException

addClassList

public int addClassList(Class newClass,
                        boolean isSelectable)
                 throws QueryException
Adds the class to the class list. A new class is added, only if the class is currently not in the class list.

Supported API: true

Parameters:
newClass - class to add
isSelectable - indicates if the class is included in the SELECT
Returns:
int position in the class list
Throws:
QueryException

getSelect

public boolean getSelect(int position)
                  throws QueryException
Returns the selectable property for the specified position in the class list. A selectable class will be returned in the QueryResult.

Supported API: true

Parameters:
position - class list position
Returns:
boolean true, if the class is selectable
Throws:
QueryException - if invalid position is specified

setSelect

public void setSelect(int position,
                      boolean isSelectable)
               throws QueryException
Sets the selectable property for the specified position in the class list. A selectable class will be returned in the QueryResult.

Supported API: true

Parameters:
position - class list position
isSelectable - indicates the class is selectable
Throws:
QueryException - if invalid position is specified

appendSearchCondition

public void appendSearchCondition(SearchCondition aSearchCondition)
                           throws QueryException
Deprecated. Replaced by appendWhere(WhereExpression, int[])

Specify a search condition for the query. The SearchCondition is applied to the first class in the class list . If the SearchCondition specifies a join, then the joinPosition is assumed to be the second class in the class list (position 1).

Throws:
QueryException - Occurs if the given attribute is not a string type.

appendSearchCondition

public void appendSearchCondition(SearchCondition aSearchCondition,
                                  int position,
                                  int joinPosition)
                           throws QueryException
Deprecated. Replaced by appendWhere(WhereExpression, int, int)

Specify a search condition for the query. The position indicates the SearchCondition class to apply the condition to. If the SearchCondition specifies a join, then the joinPosition indicates the join class. Otherwise, the joinPosition parameter is ignored.

Throws:
QueryException - Occurs if the given attribute is not a string type.

appendOrderBy

public void appendOrderBy(Class targetClass,
                          String attrName,
                          boolean descending)
                   throws QueryException
Deprecated. Replaced by appendOrderBy(OrderBy, int[])

Specify an order by clause for the query <> NOTE: Use of order by and rownum together will give unpredictable results.

Parameters:
targetClass - class for the order by attribute
attrName - name of the order by attribute
descending - true if descending, false if ascending order for this attribute
Throws:
QueryException - Occurs if the given attribute is not a member of targetClass or if targetClass is not a valid class for this QuerySpec.

appendOrderBy

public void appendOrderBy(Class targetClass,
                          String attrName,
                          boolean descending,
                          SQLFunction sqlfunction)
                   throws QueryException
Deprecated. Replaced by appendOrderBy(OrderBy, int[])

Specify an order by clause for the query <> NOTE: Use of order by and rownum together will give unpredictable results.

Parameters:
targetClass - class for the order by attribute
attrName - name of the order by attribute
descending - true if descending, false if ascending order for this attribute
sqlfunction - SQL function expression for the order by
Throws:
QueryException - Occurs if the given attribute is not a member of targetClass or if targetClass is not a valid class for this QuerySpec.

appendRowNumCondition

public void appendRowNumCondition(int rowNum)
Deprecated. Replaced by appendWhere(WhereExpression). Create the WhereExpression as follows:
 new SearchCondition(
       KeywordExpression.ROWNUM, 
       SearchCondition.LESS_THAN, 
       new ConstantExpression(new Integer(rowNum)))
 

Add a (ROWNUM < xxx) to the where clause. This will limit the selection to the first xxx - 1 rows.

Parameters:
rowNum - int value

appendOpenParen

public void appendOpenParen()
Add an opening parenthesis to the where clause.

Supported API: true


appendCloseParen

public void appendCloseParen()
Add a closing parenthesis to the where clause.

Supported API: true


appendAnd

public void appendAnd()
Add an AND operator to the where clause.

Supported API: true


appendOr

public void appendOr()
Add an OR operator to the where clause.

Supported API: true


appendNot

public void appendNot()
Add a NOT operator to the where clause.

Supported API: true


getSelectString

private void getSelectString(StringBuffer s)

getFromString

private void getFromString(StringBuffer s)

isTargetPersistable

static boolean isTargetPersistable(ClassInfo aClassInfo)
                            throws WTIntrospectionException
Throws:
WTIntrospectionException

checkPersistable

private void checkPersistable(Class queryClass)
                       throws QueryException
Throws:
QueryException

initialize

protected void initialize(Class[] queryClasses,
                          QuerySpecStatementBuilder a_statementBuilder)
                   throws QueryException
Throws:
QueryException

buildIndicies

private int[] buildIndicies(int a_fromCount,
                            int a_fromIndex)
Returns required indicies.

Parameters:
a_fromIndex -

appendSelect

void appendSelect(ItemBuilder a_itemBuilder)
            throws QueryException
Appends the ItemBuilder to the select.

Parameters:
a_itemBuilder -
Throws:
QueryException

setQueryLimit

public void setQueryLimit(int a_queryLimit)
Set the query limit for the returned results from this query.

Supported API: true

Parameters:
a_queryLimit -

toString

public String toString()
Answer a SQL Select statement defined by the Query spec


clone

public Object clone()
Create a deep-copy of this object.


clone

protected static void clone(QuerySpec clone,
                            QuerySpec original,
                            boolean a_includeStatementBuilder)
                     throws WTException
Create a deep-copy of this object.

Throws:
WTException