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>
  • Constructor Details

    • BaseQueryCommand

      public BaseQueryCommand(String controllerName, String actionName)
  • 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 first maxRows rows 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 with setMaxRows(int) to return pages of rows at a time from the server.
      Parameters:
      offset - The current offset index.
    • getSorts

      public List<Sort> getSorts()
      Returns the current list of sort definitions.
      Returns:
      The current list of sort definitions, or null if none are defined.
    • setSorts

      public void setSorts(List<Sort> sorts)
      Sets the current set of sort definitions.
      Parameters:
      sorts - The new list of sort definitions.
    • addSort

      public void addSort(Sort sort)
      Adds a new sort definition to the current list.
      Parameters:
      sort - The new sort definition.
    • addSort

      public void addSort(String columnName, Sort.Direction direction)
      Constructs and adds a new sort definition to the current list. This is equivalent to calling addSort(new Sort(columnName, direction))
      Parameters:
      columnName - The column name.
      direction - The sort direction.
      See Also:
    • getContainerFilter

      public ContainerFilter getContainerFilter()
      Returns the container filter set for this command
      Returns:
      the container filter (may be null)
    • setContainerFilter

      public void setContainerFilter(ContainerFilter containerFilter)
      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

      public Map<String,String> getQueryParameters()
      Returns:
      Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries that are parameterized.
    • setQueryParameters

      public void setQueryParameters(Map<String,String> parameters)
      Map of name (string)/value pairs for the values of parameters if the SQL references underlying queries that are parameterized.
      Parameters:
      parameters - the set of parameters
    • getJsonObject

      public org.json.JSONObject getJsonObject()
      Description copied from class: PostCommand
      Returns the JSON object to post or null for no JSON. Override this method to provide parameters as JSON.
      Overrides:
      getJsonObject in class PostCommand<ResponseType extends CommandResponse>
      Returns:
      The JSON object to post.
    • addOffsetAndMaxRows

      protected void addOffsetAndMaxRows(org.json.JSONObject json, String offsetName, String maxRowsName)
    • addSortAndParams

      protected org.json.JSONObject addSortAndParams(org.json.JSONObject json)