public abstract class BaseQueryCommand<ResponseType extends CommandResponse> extends Command<ResponseType>
Command.CommonParameters, Command.Response
Modifier and Type | Field and Description |
---|---|
protected ContainerFilter |
_containerFilter |
protected java.util.List<Filter> |
_filters |
protected int |
_maxRows |
protected int |
_offset |
protected java.util.List<Sort> |
_sorts |
CONTENT_TYPE_JSON
Constructor and Description |
---|
BaseQueryCommand(BaseQueryCommand<ResponseType> source) |
BaseQueryCommand(java.lang.String controllerName,
java.lang.String actionName) |
Modifier and Type | Method and Description |
---|---|
void |
addFilter(Filter filter)
Adds a new filter to the list.
|
void |
addFilter(java.lang.String columnName,
java.lang.Object value,
Filter.Operator operator)
Constructs and adds a new filter to the list.
|
void |
addSort(Sort sort)
Adds a new sort definition to the current list.
|
void |
addSort(java.lang.String columnName,
Sort.Direction direction)
Constructs and adds a new sort definition to the current list.
|
ContainerFilter |
getContainerFilter()
Returns the container filter set for this command
|
java.util.List<Filter> |
getFilters()
Returns the current list of filters, or null if none are defined.
|
int |
getMaxRows()
Returns the current row limit value.
|
int |
getOffset()
Returns the index of the first row in the resultset to return (defaults to 0).
|
java.util.Map<java.lang.String,java.lang.Object> |
getParameters()
Returns the current parameter map, or null if a map has not yet been set.
|
java.util.Map<java.lang.String,java.lang.String> |
getQueryParameters() |
java.util.List<Sort> |
getSorts()
Returns the current list of sort definitions.
|
void |
setContainerFilter(ContainerFilter containerFilter)
Sets the container filter for the sql to be executed.
|
void |
setFilters(java.util.List<Filter> filters)
Sets the current list of filters.
|
void |
setMaxRows(int maxRows)
Sets the current row limit value.
|
void |
setOffset(int offset)
Sets the index of the first row in the resultset to return from the server.
|
void |
setQueryParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries
that are parameterized.
|
void |
setSorts(java.util.List<Sort> sorts)
Sets the current set of sort definitions.
|
_execute, checkThrowError, copy, createRequest, createResponse, execute, getActionName, getActionUrl, getControllerName, getHttpRequest, getParamValueAsString, getQueryString, getRequiredVersion, getTimeout, setParameters, setRequiredVersion, setTimeout
protected int _maxRows
protected int _offset
protected java.util.List<Sort> _sorts
protected java.util.List<Filter> _filters
protected ContainerFilter _containerFilter
public BaseQueryCommand(BaseQueryCommand<ResponseType> source)
public BaseQueryCommand(java.lang.String controllerName, java.lang.String actionName)
public int getMaxRows()
public void setMaxRows(int maxRows)
maxRows
rows will be returned from the server.maxRows
- The maximum number of rows to return, or -1 to get all rows (default)public int getOffset()
public void setOffset(int offset)
setMaxRows(int)
to return pages of
rows at a time from the server.offset
- The current offset index.public java.util.List<Sort> getSorts()
public void setSorts(java.util.List<Sort> sorts)
sorts
- The new list of sort definitions.public void addSort(Sort sort)
sort
- The new sort definition.public void addSort(java.lang.String columnName, Sort.Direction direction)
addSort(new Sort(columnName, direction))
columnName
- The column name.direction
- The sort direction.Sort
public java.util.List<Filter> getFilters()
public void setFilters(java.util.List<Filter> filters)
filters
- The new list of filters.public void addFilter(Filter filter)
filter
- The new filter definition.public void addFilter(java.lang.String columnName, java.lang.Object value, Filter.Operator operator)
addFilter(new Filter(columnName, value, operator))
columnName
- The column name.value
- The filter value.operator
- The filter operator.Filter
public ContainerFilter getContainerFilter()
public void setContainerFilter(ContainerFilter containerFilter)
containerFilter
- the filter to apply to the query (may be null)public java.util.Map<java.lang.String,java.lang.String> getQueryParameters()
public void setQueryParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters
- the set of parameterspublic java.util.Map<java.lang.String,java.lang.Object> getParameters()
Command
getParameters
in class Command<ResponseType extends CommandResponse>