public class ExecuteQueryCommand extends ExecutableCommandWrapper implements ExecutableCommand
Executes a dynamic query, i.e. a query whose textual definition is given as an argument of the constructor, to get the Items
matching
the query criteria.
Note:
im issues
command reference manual.Usage:
ExecuteQueryCommand command = new ExecuteQueryCommand(myDatabase, "(field[Type]=\"Requirement\")"); command.execute(); MDWList<Item> result = command.getItems(); // get the Items which match the Query criteria
Constructor and Description |
---|
ExecuteQueryCommand(Database database,
String queryDefinition)
Instantiates a command to execute a dynamic query.
|
ExecuteQueryCommand(Database database,
String queryDefinition,
Collection<Field> fields)
Instantiates a command to execute a dynamic query and to read the field values of the matching items.
|
ExecuteQueryCommand(Query query,
Collection<Field> fields)
Instantiates a command to execute a registered query and to read the field values of the matching items.
|
Modifier and Type | Method and Description |
---|---|
MDWList<Item> |
getItems()
Returns the unmodifiable list of Items matching the query criteria.
|
execute
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute
public ExecuteQueryCommand(Database database, String queryDefinition)
This command executes the query and identifies the items matching the query criteria. It does not read any field values of items. Field values are retrieved on-demand individually for each item. To get better performance, clients are recommended to use the constructor that allows to specify the collection of fields of interest.
database
- the database on which the query must execute.queryDefinition
- the definition of the query to execute.ExecuteQueryCommand(Database, String, Collection)
public ExecuteQueryCommand(Database database, String queryDefinition, Collection<Field> fields)
This constructor enables to execute only one command to:
Reading the field values in the same command as the query execution provides much better performance. It is to be noted that only the fields specified in the constructor are read, meaning additional fields cannot be retrieved later on.
database
- the database on which the query must execute.queryDefinition
- the definition of the query to execute.fields
- the collections of fields to read for items matching the query criteria.public ExecuteQueryCommand(Query query, Collection<Field> fields)
This constructor enables to execute only one command to:
Reading the field values in the same command as the query execution provides much better performance. It is to be noted that only the fields specified in the constructor are read, meaning additional fields cannot be retrieved later on.
query
- a query registered in the database.fields
- the collections of fields to read for items matching the query criteria.