Class BaseQueryCommand<ResponseType extends CommandResponse>
java.lang.Object
org.labkey.remoteapi.Command<ResponseType>
org.labkey.remoteapi.PostCommand<ResponseType>
org.labkey.remoteapi.query.BaseQueryCommand<ResponseType>
- All Implemented Interfaces:
HasRequiredVersion
- Direct Known Subclasses:
BaseSelectRowsCommand, ExecuteSqlCommand
public abstract class BaseQueryCommand<ResponseType extends CommandResponse>
extends PostCommand<ResponseType>
-
Nested Class Summary
Nested classes/interfaces inherited from class Command
Command.CommonParameters, Command.Response -
Field Summary
Fields inherited from class Command
CONTENT_TYPE_JSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddOffsetAndMaxRows(org.json.JSONObject json, String offsetName, String maxRowsName) voidaddSort(String columnName, Sort.Direction direction) Constructs and adds a new sort definition to the current list.voidAdds a new sort definition to the current list.protected org.json.JSONObjectaddSortAndParams(org.json.JSONObject json) Returns the container filter set for this commandorg.json.JSONObjectReturns the JSON object to post or null for no JSON.intReturns the current row limit value.intReturns the index of the first row in the resultset to return (defaults to 0).getSorts()Returns the current list of sort definitions.booleanbooleanvoidsetContainerFilter(ContainerFilter containerFilter) Sets the container filter for the sql to be executed.voidsetIncludeMetadata(boolean includeMetadata) Pass false to omit metadata for the selected columns.voidsetIncludeTotalCount(boolean includeTotalCount) Pass false to omit total count from the response.voidsetMaxRows(int maxRows) Sets the current row limit value.voidsetOffset(int offset) Sets the index of the first row in the resultset to return from the server.voidsetQueryParameters(Map<String, String> parameters) Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries that are parameterized.voidSets the current set of sort definitions.Methods inherited from class PostCommand
createRequestMethods inherited from class Command
_execute, createParameterMap, createResponse, execute, getActionName, getControllerName, getHttpRequest, getParameters, getParamValueAsString, getRequiredVersion, getTimeout, setRequiredVersion, setTimeout
-
Constructor Details
-
BaseQueryCommand
-
-
Method Details
-
getMaxRows
public int getMaxRows()Returns the current row limit value. Defaults to -1, meaning return all rows.- Returns:
- The current row limit value.
-
setMaxRows
public void setMaxRows(int maxRows) Sets the current row limit value. If this is set to a positive value, only the firstmaxRowsrows will be returned from the server.- Parameters:
maxRows- The maximum number of rows to return, or -1 to get all rows (default)
-
getOffset
public int getOffset()Returns the index of the first row in the resultset to return (defaults to 0).- Returns:
- The current offset index.
-
setOffset
public void setOffset(int offset) Sets the index of the first row in the resultset to return from the server. Use this in conjunction withsetMaxRows(int)to return pages of rows at a time from the server.- Parameters:
offset- The current offset index.
-
getSorts
-
setSorts
-
addSort
Adds a new sort definition to the current list.- Parameters:
sort- The new sort definition.
-
addSort
Constructs and adds a new sort definition to the current list. This is equivalent to callingaddSort(new Sort(columnName, direction))- Parameters:
columnName- The column name.direction- The sort direction.- See Also:
-
getContainerFilter
Returns the container filter set for this command- Returns:
- the container filter (may be null)
-
setContainerFilter
Sets the container filter for the sql to be executed. This will cause the query to be executed over more than one container.- Parameters:
containerFilter- the filter to apply to the query (may be null)
-
isIncludeMetadata
public boolean isIncludeMetadata() -
setIncludeMetadata
public void setIncludeMetadata(boolean includeMetadata) Pass false to omit metadata for the selected columns. Defaults to true.- Parameters:
includeMetadata- Set to 'false' to omit column metadata.
-
isIncludeTotalCount
public boolean isIncludeTotalCount() -
setIncludeTotalCount
public void setIncludeTotalCount(boolean includeTotalCount) Pass false to omit total count from the response. Default is true.- Parameters:
includeTotalCount- Set to 'false' to omit total count.
-
getQueryParameters
-
setQueryParameters
-
getJsonObject
public org.json.JSONObject getJsonObject()Description copied from class:PostCommandReturns the JSON object to post or null for no JSON. Override this method to provide parameters as JSON.- Overrides:
getJsonObjectin classPostCommand<ResponseType extends CommandResponse>- Returns:
- The JSON object to post.
-
addOffsetAndMaxRows
-
addSortAndParams
protected org.json.JSONObject addSortAndParams(org.json.JSONObject json)
-