public class SelectRowsResponse extends CommandResponse
Command.execute(org.labkey.remoteapi.Connection, String)
method. This class provides helpful methods for obtaining specific bits
of the parsed response data.SelectRowsCommand
Modifier and Type | Class and Description |
---|---|
static class |
SelectRowsResponse.ColumnDataType
An enumeration of the possible column data types
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
getRows()
Returns the list of rows from the parsed response data.
|
Rowset |
getRowset()
Returns an iterable Rowset.
|
findObject, getContentType, getParsedData, getProperty, getProperty, getRequiredVersion, getSourceCommand, getStatusCode, getText
public SelectRowsResponse(java.lang.String text, int statusCode, java.lang.String contentType, org.json.simple.JSONObject json, Command sourceCommand)
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 returnedsourceCommand
- A copy of the command that created this responsepublic java.lang.Number getRowCount()
public Rowset getRowset()
public java.util.Map<java.lang.String,java.lang.Object> getMetaData()
public java.util.Map<java.lang.String,java.lang.Object> getMetaData(java.lang.String columnName)
getMetaData()
for more
information on the contents of this map.columnName
- The requested column name.public SelectRowsResponse.ColumnDataType getColumnDataType(java.lang.String columnName)
columnName
- The column name.public java.lang.String getIdColumn()
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getColumnModel()
This method will return a List of Maps, one for each column in the resultset. Each Map will contain the following properties:
public java.util.Map<java.lang.String,java.lang.Object> getColumnModel(java.lang.String columnName)
getColumnModel()
for more information.columnName
- The column name.public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getRows()
for (Map<String,Object> row : response.getRows())
{
Number key = (Number)row.get("Key");
// use Number.intValue(), doubleValue(), longValue(), etc to get various primitive types
}