Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.labkey.remoteapi.query
Class SelectRowsResponse

    java.lang.Object
      org.labkey.remoteapi.CommandResponse
          org.labkey.remoteapi.query.RowsResponse
              org.labkey.remoteapi.query.SelectRowsResponse

    public class SelectRowsResponse

extends RowsResponse

The command response class returned from the `Command.execute(org.labkey.remoteapi.Connection, String)` method. This class provides helpful methods for obtaining specific bits of the parsed response data.

See Also:
  `SelectRowsCommand`

Nested Class Summary
`static class` | `SelectRowsResponse.ColumnDataType` An enumeration of the possible column data types

Constructor Summary
`SelectRowsResponse(java.lang.String text, int statusCode, java.lang.String contentType, org.json.simple.JSONObject json, Command sourceCommand)` Constructs a new SelectRowsResponse given the response text and HTTP status code.

Method Summary
`SelectRowsResponse.ColumnDataType` | `getColumnDataType(java.lang.String columnName)` Returns the data type for the requested column name.
`java.util.List<java.util.Map<java.lang.String,java.lang.Object>>` | `getColumnModel()` Returns the column model section of the response.
`java.util.Map<java.lang.String,java.lang.Object>` | `getColumnModel(java.lang.String columnName)` Returns the column properties for the specified column name.
`java.lang.String` | `getIdColumn()` Returns the name of the column containing the primary key value for each row.
`java.util.Map<java.lang.String,java.lang.Object>` | `getMetaData()` Returns the meta-data section of the response.
`java.util.Map<java.lang.String,java.lang.Object>` | `getMetaData(java.lang.String columnName)` Returns the meta-data for a given column name.
`java.lang.Number` | `getRowCount()` Returns the number of rows this query could return.
`Rowset` | `getRowset()` Returns an iterable Rowset.

Methods inherited from class org.labkey.remoteapi.query.RowsResponse
`caseInsensitizeRowMaps, fixupParsedData, getRows`

Methods inherited from class org.labkey.remoteapi.CommandResponse
`findObject, getContentType, getParsedData, getProperty, getProperty, getRequiredVersion, getSourceCommand, getStatusCode, getText`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SelectRowsResponse

    public SelectRowsResponse(java.lang.String text,
                              int statusCode,
                              java.lang.String contentType,
                              org.json.simple.JSONObject json,
                              Command sourceCommand)

  Constructs a new SelectRowsResponse given the response text and HTTP status code.

  Parameters:
    `text` - The response text.
    `statusCode` - The HTTP status code.
    `contentType` - The Content-Type header value.
    `json` - The parsed JSONObject (or null if no JSON was returned
    `sourceCommand` - A copy of the command that created this response

Method Detail

### getRowCount

    public java.lang.Number getRowCount()

  Returns the number of rows this query could return. If a maximum row limit was set on the SelectRowsCommand, this value may be higher than the actual number of rows returned. This value allows clients that page results to know the total number of possible rows, even if only a page of them was returned.

  Returns:
    The total number of rows, or null if this value was not returned by the server.

### getRowset

    public Rowset getRowset()

  Returns an iterable Rowset. Use this to iterate over the rows, working with the Row interface, which hides the differences between the normal (<9.1) and extended (>=9.1) response formats.

  Returns:
    An iterable Rowset.

### getMetaData

    public java.util.Map<java.lang.String,java.lang.Object> getMetaData()

  Returns the meta-data section of the response. This map contains the following entries:

  - id = the column name that contains the primary key for the row.
  - fields = a List of Maps, one for each result column. Each map contains the following properties:
    - name = the name of the column.
    - type = the JSON type name of the column ('string', 'boolean', 'date', 'int', or 'float').

  Returns:
    The meta-data section of the response, or null if no section was returned by the server.

### getMetaData

    public java.util.Map<java.lang.String,java.lang.Object> getMetaData(java.lang.String columnName)

  Returns the meta-data for a given column name. See `getMetaData()` for more information on the contents of this map.

  Parameters:
    `columnName` - The requested column name.
  Returns:
    The meta-data for that column or null if that column was not found.

### getColumnDataType

    public SelectRowsResponse.ColumnDataType getColumnDataType(java.lang.String columnName)

  Returns the data type for the requested column name.

  Parameters:
    `columnName` - The column name.
  Returns:
    The column's data type, or null if the column was not found.

### getIdColumn

    public java.lang.String getIdColumn()

  Returns the name of the column containing the primary key value for each row.

  Returns:
    The name of the primary key column, or null if that information was not returned by the server.

### getColumnModel

    public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getColumnModel()

  Returns the column model section of the response. The column model contains user-interface-related information about the column, such as its header caption, whether it is editable or required, etc.

  This method will return a List of Maps, one for each column in the resultset. Each Map will contain the following properties:

  - hidden = whether this column should be hidden (Boolean).
  - sortable = whether this column can be used for sorting (Boolean).
  - align = the horizontal alignment for this column (String, 'left'|'center'|'right').
  - width = the default width (in CSS width units) for this column (String).
  - dataIndex = the name of the column (String).
  - required = whether this column is required (Boolean).
  - editable = whether this column should be editable (Boolean).
  - header = the header caption for this column (String).

  Returns:
    The column model, or null if none was returned by the server.

### getColumnModel

    public java.util.Map<java.lang.String,java.lang.Object> getColumnModel(java.lang.String columnName)

  Returns the column properties for the specified column name. See `getColumnModel()` for more information.

  Parameters:
    `columnName` - The column name.
  Returns:
    The properties for the specified column, or null if the column was not found.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD