|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwt.query.QuerySpec
public class QuerySpec
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
| Field Summary |
|---|
| Fields inherited from interface wt.pds.StatementSpec |
|---|
ADVANCED_QUERY_ENABLED, USE_BIND |
| Constructor Summary | |
|---|---|
QuerySpec()
Create the specification object. |
|
QuerySpec(Class queryClass)
Create the specification object and identify the base class to be searched. |
|
QuerySpec(Class baseClass1,
Class baseClass2)
Create the specification object and identify the base classes to be searched. |
|
| 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. |
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 |
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(OrderBy a_orderBy,
int[] a_fromIndicies)
This method appends the OrderBy expression to the OrderBy clause of the query. |
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 |
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,
boolean a_fullObject)
Appends the class reference to the select clause. |
void |
appendSelectReference(String a_attributeName,
int a_classIndex,
boolean a_fullObject)
Appends the class reference to the select clause. |
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. |
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. |
int |
getConditionCount()
Gets the value of the attribute: conditionCount; Indicates the number of search conditions appended to this Query. |
int |
getDepthThreshold()
Gets the value of the attribute: depthThreshold; Threshold value for the number of subclass combinations. |
FromClause |
getFromClause()
Gets the object for the association that plays role: fromClause. |
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. |
boolean |
isAdvancedQueryEnabled()
Gets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled. |
boolean |
isDistinct()
Gets the value of the attribute: distinct; Indicates whether Query returns distinct results. |
boolean |
isUseBind()
Gets the value of the attribute: useBind; Indicates if bind parameters should be used when appending SearchConditions. |
void |
setAdvancedQueryEnabled(boolean a_AdvancedQueryEnabled)
Sets the value of the attribute: advancedQueryEnabled; Indicates if advanced query capabilities are enabled. |
void |
setDepthThreshold(int a_DepthThreshold)
Sets the value of the attribute: depthThreshold; Threshold value for the number of subclass combinations. |
void |
setDistinct(boolean a_Distinct)
Sets the value of the attribute: distinct; Indicates whether Query returns distinct results. |
void |
setLocale(Locale a_locale)
Set the client locale. |
void |
setQueryLimit(int a_queryLimit)
Set the query limit for the returned results from this query. |
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. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public QuerySpec()
throws QueryException
QueryException
public QuerySpec(Class queryClass)
throws QueryException
queryClass - The class (plus it subclasses) being searched
for persistent objects.
QueryException - Occurs if the given class is not persistent.
public QuerySpec(Class baseClass1,
Class baseClass2)
throws QueryException
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.
QueryException - Occurs if the given class is not persistent.| Method Detail |
|---|
public boolean isDistinct()
public void setDistinct(boolean a_Distinct)
throws WTPropertyVetoException
a_Distinct -
WTPropertyVetoExceptionpublic int getConditionCount()
public boolean isUseBind()
isUseBind in interface StatementSpec
public void setUseBind(boolean a_UseBind)
throws WTPropertyVetoException
setUseBind in interface StatementSpeca_UseBind -
WTPropertyVetoExceptionpublic int getBindParameterCount()
public int getDepthThreshold()
public void setDepthThreshold(int a_DepthThreshold)
throws WTPropertyVetoException
a_DepthThreshold -
WTPropertyVetoExceptionpublic boolean isAdvancedQueryEnabled()
isAdvancedQueryEnabled in interface StatementSpecpublic void setAdvancedQueryEnabled(boolean a_AdvancedQueryEnabled)
setAdvancedQueryEnabled in interface StatementSpeca_AdvancedQueryEnabled - public FromClause getFromClause()
public int getResultIndex(int a_classIndex)
a_classIndex -
public int[] getResultIndicies()
public void appendSelectAttribute(String a_attributeName,
int a_classIndex,
boolean a_selectOnly)
throws QueryException
a_attributeName - a_classIndex - a_selectOnly -
QueryExceptionpublic int appendFrom(TableExpression a_tableExpression)
a_tableExpression -
public Object getBindParameterAt(int a_index)
a_index -
public void appendWhere(WhereExpression a_whereExpression,
int a_fromIndex)
throws QueryException
a_whereExpression - a_fromIndex -
QueryException
public void appendWhere(WhereExpression a_whereExpression,
int a_fromIndex1,
int a_fromIndex2)
throws QueryException
a_whereExpression - a_fromIndex1 - a_fromIndex2 -
QueryException
public void appendWhere(WhereExpression a_whereExpression,
TableExpression[] a_tableExpressions,
String[] a_aliases)
throws QueryException
a_whereExpression - a_tableExpressions - a_aliases -
QueryException
public void appendSelect(ColumnExpression a_column,
boolean a_selectOnly)
throws QueryException
a_column - a_selectOnly -
QueryException
public void appendSelectReference(String a_attributeName,
int a_classIndex,
boolean a_fullObject)
throws QueryException
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.
QueryException
public void appendSelectReference(ColumnExpression a_className,
ColumnExpression a_id,
int a_classNameFromIndex,
int a_idFromIndex,
boolean a_fullObject)
throws QueryException
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.
QueryException
public void appendWhere(WhereExpression a_whereExpression,
int[] a_fromIndicies)
throws QueryException
a_whereExpression - a_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpressions in the WhereExpression
QueryException
public void appendSelect(ColumnExpression a_column,
int[] a_fromIndicies,
boolean a_selectOnly)
throws QueryException
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 ColumnExpressiona_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.
QueryException
public void appendOrderBy(OrderBy a_orderBy,
int[] a_fromIndicies)
throws QueryException
a_orderBy - OrderBy expression to appenda_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpression in the OrderBy
QueryException
public void appendGroupBy(ColumnExpression a_column,
int[] a_fromIndicies,
boolean a_appendSelect)
throws QueryException
a_column - object to appenda_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpressiona_appendSelect - Indicates if the ColumnExpression should be appended to the SELECT clause also.
QueryException
public void appendJoin(int a_linkIndex,
String a_role,
Persistable a_source)
throws WTException
a_linkIndex - Index of the link class in this QuerySpeca_role - The role on the link associationa_source - The Persistable instance to join the link to
WTException
public void appendJoin(int a_linkIndex,
String a_role,
int a_targetIndex)
throws WTException
a_linkIndex - Index of the link class in this QuerySpeca_role - The role on the link associationa_targetIndex - The index of the target class to join the link to
WTException
public void appendHint(String a_hint)
throws QueryException
a_hint - This is the hint which will be specified.
QueryException
public void appendHaving(WhereExpression a_where,
int[] a_fromIndicies)
throws QueryException
a_where - object to appenda_fromIndicies - array of ordinal index values into the QuerySpec's FromClause that reference TableExpressions used by the ColumnExpressions in the WhereExpression
QueryException
public void setLocale(Locale a_locale)
throws WTException
setLocale in interface StatementSpeca_locale -
WTException
public int appendClassList(Class newClass,
boolean isSelectable)
throws QueryException
newClass - class to appendisSelectable - indicates if the class is included in the SELECT
QueryException
public int addClassList(Class newClass,
boolean isSelectable)
throws QueryException
newClass - class to addisSelectable - indicates if the class is included in the SELECT
QueryException
public boolean getSelect(int position)
throws QueryException
position - class list position
QueryException - if invalid position is specified
public void setSelect(int position,
boolean isSelectable)
throws QueryException
position - class list positionisSelectable - indicates the class is selectable
QueryException - if invalid position is specifiedpublic void appendOpenParen()
public void appendCloseParen()
public void appendAnd()
public void appendOr()
public void appendNot()
public void setQueryLimit(int a_queryLimit)
a_queryLimit -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||