public class Query
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FINDER |
static short |
MAX_LIMIT |
static short |
NO_LIMIT |
static java.lang.String |
WILD_PATTERN |
| Modifier and Type | Method and Description |
|---|---|
void |
addPostCommand(java.lang.String command)
Adds a MQL command that should be performed after the query is
executed.
|
void |
addPrepareCommand(java.lang.String command)
Adds a MQL command that should be performed before the query is
executed.
|
void |
clearPostCommand()
Clears the list of commands that are executed after the query is
executed.
|
void |
clearPrepareCommand()
Clears the list of commands that are executed before the query is
executed.
|
static void |
deleteQuery(java.lang.String queryName)
Deletes a query from the database, with the specified name.
|
matrix.db.BusinessObjectList |
evaluate()
Evaluates the query.
|
void |
evaluateInto(TableBean<?> table,
boolean append) |
void |
evaluateIntoSet(java.lang.String setName,
boolean append)
Evaluates the query into the set with the specified name.
|
java.lang.String[] |
evaluateOverSet(java.lang.String setName) |
QueryIterator |
getIterator(java.util.List<?> selects,
short pageSize)
Evaluates the query and selects the specified select statements.
|
java.lang.String |
getNamePattern() |
java.lang.String |
getOwnerPattern() |
int |
getQueryLimit() |
java.lang.String |
getQueryName()
Returns the name of the query, or null, if no name has been specified.
|
static java.lang.String[] |
getQueryNames()
Retrieves the names of the user's saved queries.
|
java.lang.String |
getRevPattern() |
java.lang.String |
getSearchFormat() |
java.lang.String |
getSearchText() |
java.lang.String |
getTypePattern() |
boolean |
getUseQueryTrigger() |
java.lang.String |
getVaultPattern() |
java.lang.String |
getWhere() |
static boolean |
hasNativeIteratorSupport() |
static boolean |
isEmpty(java.lang.String s)
Returns true if the string is empty when whitespace characters have been
stripped.
|
boolean |
isExpandType() |
static boolean |
isWildPattern(java.lang.String pattern)
Returns true if the pattern is wild when whitespace characters have been
stripped.
|
static Query |
newInstance() |
static Query |
newInstance(java.lang.String queryName) |
protected java.lang.String |
paramString() |
protected java.lang.StringBuilder |
paramString(java.lang.StringBuilder sb,
boolean addNewLine) |
void |
saveQuery()
Saves this query persistently into the database if this instance has a
name associated.
|
matrix.db.BusinessObjectWithSelectList |
select(java.util.List<?> selects)
Evaluates the query and selects the specified select statements.
|
matrix.db.BusinessObjectWithSelectList |
select(Statement statement)
Evaluates the query and selects the specified select statement
|
matrix.db.BusinessObjectWithSelectList |
select(Statement[] stmts)
Evaluates the query and selects the specified select statements
|
matrix.db.BusinessObjectWithSelectList |
select(java.lang.String statement)
Evaluates the query and selects the specified select statement.
|
matrix.db.BusinessObjectWithSelectList |
select(java.lang.String[] select)
Evaluates the query and selects the specified select statements.
|
java.lang.String[] |
selectId()
Evaluates the query and returns the id's of the objects found by the
query.
|
void |
setExpandType(boolean expandType)
Defines if the query also should return objects, whose type is derived
from any of the types defined in the type pattern.
|
void |
setNamePattern(java.lang.String namePattern)
Sets the name pattern.
|
void |
setOwnerPattern(java.lang.String ownerPattern)
Sets the owner pattern.
|
void |
setQueryLimit(int queryLimit)
Defies the query limit.
|
void |
setQueryName(java.lang.String queryName)
Gives the query a name, and causes the query to be saved once it is
evaluated.
|
void |
setRevPattern(java.lang.String revPattern)
Sets the revision pattern.
|
void |
setSearchFormat(java.lang.String searchFormat) |
void |
setSearchText(java.lang.String searchText) |
void |
setTypePattern(java.lang.String typePattern)
Sets the type pattern.
|
void |
setUseQueryTrigger(boolean useQueryTrigger) |
void |
setVaultPattern(java.lang.String vaultPattern)
Sets the vault pattern.
|
void |
setWhere(java.lang.String where)
Sets the where expression that will be used to limit the query result.
|
static matrix.db.BusinessObjectList |
tempQuery(java.lang.String type,
java.lang.String name,
java.lang.String revision)
Executes a temporary query and returns the result.
|
static matrix.db.BusinessObjectList |
tempQuery(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String where)
Executes a temporary query and returns the result.
|
static matrix.db.BusinessObjectList |
tempQuery(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String vault,
java.lang.String owner,
java.lang.String text,
java.lang.String format,
java.lang.String where,
boolean expand,
short limit)
Executes a temporary query and returns the result.
|
static matrix.db.BusinessObjectWithSelectList |
tempQuerySelect(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String vault,
java.lang.String where,
java.util.List<?> selects)
Executes a query and selects the specified statements.
|
static matrix.db.BusinessObjectWithSelectList |
tempQuerySelect(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String vault,
java.lang.String owner,
java.lang.String text,
java.lang.String format,
java.lang.String where,
boolean expand,
short limit,
java.util.List<?> selects)
Executes a query and selects the specified statements.
|
java.lang.String |
toString() |
boolean |
willSaveQuery()
Returns whether or not the query will be saved.
|
public static final java.lang.String WILD_PATTERN
public static final java.lang.String FINDER
public static final short NO_LIMIT
public static final short MAX_LIMIT
public static Query newInstance(java.lang.String queryName) throws TVCException
Query instance. The query
is populated from the query, stored in the database with the
given name.TVCExceptionpublic boolean willSaveQuery()
public void addPrepareCommand(java.lang.String command)
command - A MQL command.public void clearPrepareCommand()
public void addPostCommand(java.lang.String command)
command - A MQL command.public void clearPostCommand()
public void setQueryName(java.lang.String queryName)
Note: Matrix has a name limitation of 127 chars for a query name. Note: The name of a query might not contain certain characters. This method will not try to validate these.
public java.lang.String getQueryName()
public void setTypePattern(java.lang.String typePattern)
Note: A pattern can not be longer than 127 characters (Matrix limitation)
typePattern - The type patternpublic java.lang.String getTypePattern()
public void setNamePattern(java.lang.String namePattern)
Note: A pattern can not be longer than 127 characters (Matrix limitation)
namePattern - The name patternpublic java.lang.String getNamePattern()
public void setRevPattern(java.lang.String revPattern)
Note: A pattern can not be longer than 127 characters (Matrix limitation)
revPattern - The revision patternpublic java.lang.String getRevPattern()
public void setVaultPattern(java.lang.String vaultPattern)
Note: A pattern can not be longer than 127 characters (Matrix limitation)
vaultPattern - The vault patternpublic java.lang.String getVaultPattern()
public void setOwnerPattern(java.lang.String ownerPattern)
Note: A pattern can not be longer than 127 characters (Matrix limitation)
ownerPattern - The owner patternpublic java.lang.String getOwnerPattern()
public void setExpandType(boolean expandType)
Default is false.
expandType - True if the type pattern applies to derived typespublic boolean isExpandType()
public void setQueryLimit(int queryLimit)
Note: Matrix has an upper limit of 32767
queryLimit - The query limit.public int getQueryLimit()
public void setWhere(java.lang.String where)
where - The where clause.public java.lang.String getWhere()
public void setSearchFormat(java.lang.String searchFormat)
public java.lang.String getSearchFormat()
public void setSearchText(java.lang.String searchText)
public java.lang.String getSearchText()
public void setUseQueryTrigger(boolean useQueryTrigger)
public boolean getUseQueryTrigger()
public void saveQuery()
throws TVCException
TVCException - Upon db errorspublic static java.lang.String[] getQueryNames()
public void evaluateInto(TableBean<?> table, boolean append) throws TVCException
table - The tablebean that will hold the resultappend - True if to append the query resultTVCExceptionpublic matrix.db.BusinessObjectList evaluate()
throws TVCException
TVCException - if unable to evalute.public matrix.db.BusinessObjectWithSelectList select(java.lang.String[] select)
throws TVCException
select - the select statements.TVCException - if unable to evalute.public matrix.db.BusinessObjectWithSelectList select(java.lang.String statement)
throws TVCException
statement - the select statement.TVCException - if unable to evalute.public matrix.db.BusinessObjectWithSelectList select(Statement statement) throws TVCException
statement - The statement to be usedTVCException - if unable to evaluate the querypublic matrix.db.BusinessObjectWithSelectList select(Statement[] stmts) throws TVCException
stmts - An array of statementsTVCException - if unable to evaluate the querypublic java.lang.String[] selectId()
throws TVCException
TVCException - if unable to evaluate the querypublic matrix.db.BusinessObjectWithSelectList select(java.util.List<?> selects)
throws TVCException
selects - the select statements. Note that this parameter can be an
instance of any class that implements the java.util.List
interface but will be converted to a
matrix.util.StringList if necessary. Also note that the
list should contain instances of java.lang.String.TVCException - if unable to evalute.public java.lang.String[] evaluateOverSet(java.lang.String setName)
throws TVCException
setName - strings containing object id'sTVCExceptionpublic static void deleteQuery(java.lang.String queryName)
throws TVCException
queryName - The name of the query to deleteTVCException - If unable to delete the querypublic void evaluateIntoSet(java.lang.String setName,
boolean append)
throws TVCException
setName - the name of the set.append - whether to append the objects from the result to the set or
not.TVCException - if an error occurrs.public static matrix.db.BusinessObjectList tempQuery(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String vault,
java.lang.String owner,
java.lang.String text,
java.lang.String format,
java.lang.String where,
boolean expand,
short limit)
throws TVCException
type - the business object type pattern.name - the business object name pattern.revision - the business object revision pattern.vault - the vault pattern.owner - the owner pattern.text - the search text.format - the search format.where - the where expression.expand - whether to expand type or not.limit - the search limit.TVCException - if unable to query the database.public static matrix.db.BusinessObjectList tempQuery(java.lang.String type,
java.lang.String name,
java.lang.String revision)
throws TVCException
type - the business object type pattern.name - the business object name pattern.revision - the business object revision pattern.TVCException - if unable to query the database.public static matrix.db.BusinessObjectList tempQuery(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String where)
throws TVCException
type - the business object type pattern.name - the business object name pattern.revision - the business object revision pattern.where - the where expression.TVCException - if unable to query the database.public static matrix.db.BusinessObjectWithSelectList tempQuerySelect(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String vault,
java.lang.String where,
java.util.List<?> selects)
throws TVCException
TVCExceptionpublic static matrix.db.BusinessObjectWithSelectList tempQuerySelect(java.lang.String type,
java.lang.String name,
java.lang.String revision,
java.lang.String vault,
java.lang.String owner,
java.lang.String text,
java.lang.String format,
java.lang.String where,
boolean expand,
short limit,
java.util.List<?> selects)
throws TVCException
TVCExceptionprotected java.lang.String paramString()
protected java.lang.StringBuilder paramString(java.lang.StringBuilder sb,
boolean addNewLine)
public java.lang.String toString()
toString in class java.lang.Objectpublic static boolean isWildPattern(java.lang.String pattern)
public static boolean isEmpty(java.lang.String s)
public QueryIterator getIterator(java.util.List<?> selects, short pageSize) throws TVCException
selects - the select statements. Note that this parameter can be an
instance of any class that implements the java.util.List
interface but will be converted to a
matrix.util.StringList if necessary. Also note that the
list should contain instances of java.lang.String.pageSize - The page size to use for streaming data source.TVCException - if unable to evalute.public static boolean hasNativeIteratorSupport()
Copyright ? Technia AB. All Rights Reserved.