|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.mdm.index.query.QueryObject
The QueryObject class represents the criteria and conditions of an object query in the master index. It is the primary class for interacting with the Query Manager (class QueryManager), which executes each query. QueryObject holds the query information read by the Query Manager, and is used to set select fields for an object and to set conditions on object fields. The Query Manager transforms the query object into a relational database SQL query. The generated SQL statements contain select fields and conditions as the WHERE clause of the SQL query and always include primary keys of the objects. The statements might also include an "ORDER BY primary_key" clause.
You can query from multiple objects and set conditions on any object attributes. The relationship between objects does not need to be specified by the client; they are obtained internally and mapped by the Query Manager. Use the qualified field name syntax to specify fields (see the Master Index Studio or eIndex Single Patient Identifier User's Guide for more information about field syntax conventions).
Field Summary |
Fields inherited from interface com.sun.mdm.index.query.QueryConstants |
MULTIPLE_QUERY, SINGLE_QUERY |
Constructor Summary | |
QueryObject()
Creates a new instance of the QueryObject class. |
|
QueryObject(QueryObject qo)
This a copy constructor for the QueryObject class and creates a copy of the specified query object. |
Method Summary | |
void |
addCondition(Condition condition)
Adds a condition, specified by an instance of the Condition class to the query object. |
void |
addCondition(java.lang.String field,
java.lang.String value)
This is an overload method of addCondition, differing in that the default operator is = (equal to) and the value is a string. |
void |
addCondition(java.lang.String field,
java.lang.String operator,
java.lang.Object value)
Specifies a condition for the WHERE clause of the SQL query. |
void |
addCondition(java.lang.String field,
java.lang.String operator,
java.lang.String value)
This is an overload method of addCondition, differing in that the value parameter is a String. |
void |
addSelect(java.lang.String field)
Adds a field to the SELECT portion of the SQL statement. |
(package private) void |
calcConditionsBlocks()
|
void |
clearQueryConditions()
|
(package private) boolean |
compareSelectFields(QueryObject otherQueryObject)
|
(package private) boolean |
compareWith(QueryObject otherQueryObject,
java.util.Map bindingAssociation)
|
(package private) boolean |
containsCondition()
Indicates whether the given query object includes conditions. |
boolean |
equals(java.lang.Object theOther)
|
(package private) AssembleDescriptor |
getAssembleDescriptor()
Retrieves the assemble descriptor (class AssembleDescriptor) for the query object. |
(package private) QueryObjectCache |
getCacheRef()
|
(package private) Condition[] |
getConditionsUnion()
Retrieves the conditions defined for the query object. |
(package private) int |
getFetchSize()
Retrieves the specified number of objects to return in each batch. |
(package private) java.lang.String[][] |
getHints()
Retrieves the SQL hints defined for the query object. |
(package private) int |
getMaxObjects()
Retrieves the maximum number of objects to be returned from the query. |
(package private) int |
getMaxRows()
Retrieves the maximum number of rows to be returned from the query. |
(package private) QueryParser |
getParser()
|
(package private) int |
getQueryOption()
|
(package private) Condition[] |
getReconstructedConditionsUnion()
|
(package private) int |
getResultSetType()
Return the ResultSet Type for the query object. |
(package private) java.lang.String |
getRoot()
|
(package private) java.lang.String[] |
getRootId()
Retrieves the fully qualified path for the primary keys of the root object in the query object. |
(package private) java.lang.String[] |
getSelectFields()
|
(package private) SQLDescriptor[] |
getSQLDescriptor()
|
int |
hashCode()
|
(package private) void |
initializeOriginalConditionsForPrepare()
|
(package private) boolean |
isOldFormatConditionExpression(Condition[] conditions)
|
(package private) boolean |
isPrepare()
|
(package private) SQLDescriptor[] |
parse()
Parses the conditions of the query object, creating the SQL statements to use for the query. |
(package private) void |
parseOriginalConditionsTree()
|
(package private) void |
preInitializeForCacheComparision()
Initializes the query object prior to parsing the conditions. |
(package private) void |
reconstructConditionExpression()
|
void |
setAssembleDescriptor(AssembleDescriptor assDesc)
Sets the assemble descriptor (class AssembleDescriptor) for the QueryObject. |
(package private) void |
setCacheRef(QueryObjectCache qoc)
|
void |
setCondition(Condition[] conditions)
Specifies all the conditions of the query. |
void |
setCondition(Condition[][] conditions)
Specifies multiple sets of conditions so the query object (more specifically the Query Manager) will logically use a UNION operator between each set of conditions in the SQL statement. |
void |
setFetchSize(int fetchSize)
Specifies the number of objects to return in each batch. |
void |
setHints(java.lang.String[][] hints)
Adds Oracle hints to the SELECT statements of the SQL query. |
void |
setMaxObjects(int maxObjects)
Limits the maximum number of objects returned from a query. |
(package private) void |
setMaxRows(int rows)
Limits the maximum number of rows returned from the query. |
void |
setOrderBy(java.lang.String orderbyField)
Specify the order of results using order by field. |
void |
setPreparedId(java.lang.String identifier)
Sets an identification for the query object to be used for prepared statements. |
void |
setQueryOption(int option)
Specifies a query option that indicates to the parser whether to perform a single or multiple query. |
(package private) void |
setQueryParser()
|
(package private) void |
setQueryParser(QueryParser queryParser)
|
void |
setResultSetType(int type)
Sets ResultSet type for this QueryObject tree. |
void |
setSelect(java.lang.String[] fields)
Specifies multiple fields for the SELECT portion of the SQL statement. |
(package private) void |
setSQLDescriptor(SQLDescriptor[] sqlDesc)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public QueryObject()
public QueryObject(QueryObject qo)
qo
- The query object to copy.
Method Detail |
public void addCondition(Condition condition)
condition
- The condition to be added to the query object.
void
- None.
public void addCondition(java.lang.String field, java.lang.String value)
field
- The fully qualified field name for the WHERE clause.value
- The value for the WHERE clause.
void
- None.
public void addCondition(java.lang.String field, java.lang.String operator, java.lang.Object value)
field
- The fully qualified field name for the WHERE clause.operator
- The SQL operator for the WHERE clause. Available operators
are = (equal to) and LIKE.value
- The value for the WHERE clause. The value can be of the
type java.sql.
void
- None.
public void addCondition(java.lang.String field, java.lang.String operator, java.lang.String value)
field
- The fully qualified field name for the WHERE clause.operator
- The SQL operator for the WHERE clause. Available operators
are = (equal to) and LIKE.value
- The value for the WHERE clause.
void
- None.
public void addSelect(java.lang.String field)
field
- The name of a field to include in the SELECT portion of t
the SQL statement.
void
- None.
void calcConditionsBlocks()
public void clearQueryConditions()
boolean compareSelectFields(QueryObject otherQueryObject)
boolean compareWith(QueryObject otherQueryObject, java.util.Map bindingAssociation)
boolean containsCondition()
boolean
- Boolean true or false. This method
returns true if the query object includes conditions; it
returns false the object does not include conditions.
public boolean equals(java.lang.Object theOther)
AssembleDescriptor getAssembleDescriptor()
AssembleDescriptor
- The assemble descriptor for the
query object.
QueryObjectCache getCacheRef()
Condition[] getConditionsUnion()
Condition[]
- An array of conditions defined
for the query object.
int getFetchSize()
int
- The specified batch size.
java.lang.String[][] getHints()
String[][]
- Arrays of hints defined for the
query object.
int getMaxObjects()
int
- The maximum number of objects to be returned.
int getMaxRows()
int
- The maximum number of rows to be returned.
QueryParser getParser()
int getQueryOption()
Condition[] getReconstructedConditionsUnion()
int getResultSetType()
int
- Type of ResultSet
java.lang.String getRoot()
java.lang.String[] getRootId() throws QMException
String[]
- An array of root object primary keys.
QMException
- Thrown if an error occurs while retrieving the
primary keys.java.lang.String[] getSelectFields()
SQLDescriptor[] getSQLDescriptor()
public int hashCode()
void initializeOriginalConditionsForPrepare()
boolean isOldFormatConditionExpression(Condition[] conditions)
boolean isPrepare()
SQLDescriptor[] parse() throws QMException
SQLDescriptor[]
- An array of SQL descriptors for the
query object.
QMException
- Thrown if an error occurs while parsing the conditions.void parseOriginalConditionsTree()
void preInitializeForCacheComparision()
void
- None.
void reconstructConditionExpression()
public void setAssembleDescriptor(AssembleDescriptor assDesc)
Note: This method is not required if you intend to delay the assembly of the query object. Use the QueryManager.execute() method instead.
assDesc
- The assemble descriptor to use for this query object.
void
- None.
void setCacheRef(QueryObjectCache qoc)
public void setCondition(Condition[] conditions)
conditions
- An array of query conditions (including the name
operator, and value).
void
- None.
public void setCondition(Condition[][] conditions)
conditions
- An array of query condition arrays.
void
- None.
public void setFetchSize(int fetchSize)
fetchSize
- The maximum number of objects to return in each batch.
void
- None.
public void setHints(java.lang.String[][] hints)
To use this method properly, determine how many queries are generated by running in DEBUG mode first. Then you can set the SQL text appropriately. If the number of hints is less than the number of generated SELECT statements, the remaining SELECT statements are not passed any hints. If the number of hints is greater than the number of SELECT statements, the extra hints are ignored. The Query Manager automatically adds any necessary delimiters, such as "/*+" to the hint.
Usage example: To pass the hint "FIRST_ROWS_100" to only the first SELECT statement, use the following: String hints[][] = {{"FIRST_ROWS_100"}}
hints
- An array of hints to add to the SELECT statements generated by
the Query Manager.
void
- None.
public void setMaxObjects(int maxObjects)
Note: Internally, the Query Manager may convert maxObjects to "rownum < X" in the WHERE clause (where "X" is the maximum number of objects you specify). The Query Manager may retrieve more rows than specified in order to create the maximum number of objects.
maxObjects
- The maximum number of objects to be retrieved.
void
- None.
void setMaxRows(int rows)
rows
- The maximum number of rows to be retrieved.
void
- None.
public void setOrderBy(java.lang.String orderbyField)
orderbyField
- order bypublic void setPreparedId(java.lang.String identifier)
identifier
- The name of the query object (QueryObject).
void
- None.
public void setQueryOption(int option)
option
- An identification code that indicates which query option
to use. 1 indicates SINGLE_QUERY; 2 indicates MULTIPLE_QUERY.
void
- None.
void setQueryParser()
void setQueryParser(QueryParser queryParser)
public void setResultSetType(int type)
type
- ResultSet Typepublic void setSelect(java.lang.String[] fields)
fields
- An array of fields to be selected in the SQL query.
void
- None.
void setSQLDescriptor(SQLDescriptor[] sqlDesc)
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Sun Microsystems, Inc.