|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.visualization.datasource.query.Query
public class Query
Holds the query data and clauses. This class is the result of parsing the query
string that comes from the user.
The clauses that can be included in a query are: select, filter, sort, group by, pivot, options,
labels, format, limit, and offset.
For more details see the
query language reference
.
A Query can be executed by the query engine
(see: DataSourceHelper.applyQuery(com.google.visualization.datasource.query.Query, com.google.visualization.datasource.datatable.DataTable, com.ibm.icu.util.ULocale)).
It can be split in 2 Query objects based on the Capabilities value
(see: DataSourceHelper.splitQuery(com.google.visualization.datasource.query.Query, com.google.visualization.datasource.Capabilities)).
Note on errors: Since this class handles a user generated query, all errors
(of type INVALID_QUERY) should provide a descriptive error message for both
the user.
| Field Summary | |
|---|---|
protected QuerySelection |
selection
The required selection. |
| Constructor Summary | |
|---|---|
Query()
Constructs a new, empty, query. |
|
| Method Summary | |
|---|---|
void |
copyFrom(Query query)
Copies all information from the given query to this query. |
void |
copyRowLimit(Query originalQuery)
Sets the max number of rows to return to the caller, based on another query. |
void |
copyRowOffset(Query originalQuery)
Sets the number of rows to skip, based on another query. |
boolean |
equals(java.lang.Object obj)
|
java.util.Set<AggregationColumn> |
getAllAggregations()
Returns all aggregation columns used in all parts of this query. |
java.util.Set<java.lang.String> |
getAllColumnIds()
Returns all simple column IDs in use in all parts of the query. |
java.util.Set<ScalarFunctionColumn> |
getAllScalarFunctionsColumns()
Returns all scalar function columns in this query. |
QueryFilter |
getFilter()
Returns the required filter of this query. |
QueryGroup |
getGroup()
Returns the required group of the query result. |
QueryLabels |
getLabels()
Returns the query labels. |
QueryOptions |
getOptions()
Returns the options for this query. |
QueryPivot |
getPivot()
Returns the required pivot of the query result. |
int |
getRowLimit()
Returns the maximum number of rows to return to the caller. |
int |
getRowOffset()
Returns the number of rows that should be removed from the beginning of the data table. |
QuerySelection |
getSelection()
Returns the required selection of the query result. |
QuerySort |
getSort()
Returns the required sort of the query result. |
QueryFormat |
getUserFormatOptions()
Returns the query formatting options. |
boolean |
hasFilter()
Returns whether or not this query has a filter defined. |
boolean |
hasGroup()
Returns true if the query has a group-by section. |
int |
hashCode()
|
boolean |
hasLabels()
Returns true if this query has labels defined. |
boolean |
hasOptions()
Returns true if this query has any nondefault options set. |
boolean |
hasPivot()
Returns true if the query has a pivot-by section. |
boolean |
hasRowLimit()
Returns true if this query has a row limit set. |
boolean |
hasRowOffset()
Returns true if this query has a row offset set. |
boolean |
hasSelection()
Returns true if there is a non-trivial selection, i.e. |
boolean |
hasSort()
Returns true if the query has a non empty sort-by section. |
boolean |
hasUserFormatOptions()
Returns true if this query has user format options defined. |
boolean |
isEmpty()
Returns true if the query is empty, i.e. |
void |
setFilter(QueryFilter filter)
Set the required filter of this query. |
void |
setGroup(QueryGroup group)
Sets the required group of the query result. |
void |
setLabels(QueryLabels labels)
Sets the query labels. |
void |
setOptions(QueryOptions options)
Sets the required options for this query. |
void |
setPivot(QueryPivot pivot)
Sets the required pivot of the query result. |
void |
setRowLimit(int rowLimit)
Sets the max number of rows to return to the caller. |
void |
setRowOffset(int rowOffset)
Sets the number of rows that should be removed from the beginning of the data table. |
void |
setSelection(QuerySelection selection)
Set the required selection of the query result. |
void |
setSort(QuerySort sort)
Set the required sort of the query result. |
void |
setUserFormatOptions(QueryFormat userFormatOptions)
Sets the user formatting options map. |
java.lang.String |
toQueryString()
Returns a string that when fed to the query parser will yield an identical Query. |
void |
validate()
Validates the query. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected QuerySelection selection
| Constructor Detail |
|---|
public Query()
| Method Detail |
|---|
public void setSort(QuerySort sort)
sort - The required sort of the query result.public QuerySort getSort()
public boolean hasSort()
public void setSelection(QuerySelection selection)
selection - The required selection of the query result.public QuerySelection getSelection()
public boolean hasSelection()
public void setFilter(QueryFilter filter)
filter - The required filter of this query.public QueryFilter getFilter()
public boolean hasFilter()
public void setGroup(QueryGroup group)
group - The required group of the query result.public void setPivot(QueryPivot pivot)
pivot - The required pivot of the query result.public QueryGroup getGroup()
public boolean hasGroup()
public QueryPivot getPivot()
public boolean hasPivot()
public int getRowLimit()
public void setRowLimit(int rowLimit)
throws InvalidQueryException
rowLimit - The max number of rows to return.
InvalidQueryException - Thrown if an invalid value is specified.public void copyRowLimit(Query originalQuery)
originalQuery - The query from which the row limit should be taken.public boolean hasRowLimit()
public int getRowOffset()
public void setRowOffset(int rowOffset)
throws InvalidQueryException
rowOffset - The number of rows to skip from the beginning of the
table.
InvalidQueryException - Thrown if an invalid value is specified.public void copyRowOffset(Query originalQuery)
originalQuery - The query from which the row offset should be taken.public boolean hasRowOffset()
public QueryFormat getUserFormatOptions()
public void setUserFormatOptions(QueryFormat userFormatOptions)
userFormatOptions - A map of patterns to column IDs.public boolean hasUserFormatOptions()
public QueryLabels getLabels()
public void setLabels(QueryLabels labels)
labels - A map of labels to column IDs.public boolean hasLabels()
public QueryOptions getOptions()
public void setOptions(QueryOptions options)
options - The required options.public boolean hasOptions()
public boolean isEmpty()
public void copyFrom(Query query)
query - The query to copy from.
public void validate()
throws InvalidQueryException
InvalidQueryExceptionpublic java.util.Set<java.lang.String> getAllColumnIds()
public java.util.Set<AggregationColumn> getAllAggregations()
public java.util.Set<ScalarFunctionColumn> getAllScalarFunctionsColumns()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toQueryString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||