public class SelectRowsCommand extends BaseQueryCommand<SelectRowsResponse> implements BaseSelect
Command.execute(org.labkey.remoteapi.Connection, String)
method.
All data exposed from a LabKey Server is organized into a set of queries contained in a set of schemas. A schema is simply a group of queries, identified by a name (e.g., 'lists' or 'study'). A query is a particular table or view within that schema (e.g., 'People' or 'Peptides'). For purposes of selecting, a query may be either a base table or a view that joins data between related tables.
To view the schemas and queries exposed in a given folder, add a Query web part to your portal page and choose the option "Show the list of tables in this schema" in the part configuration page. Alternatively, if it is exposed, click on the Query tab across the top of the main part of the page.Example:
Connection cn = new Connection("https://labkey.org");
SelectRowsCommand cmd = new SelectRowsCommand("study", "Physical Exam");
SelectRowsResponse response = cmd.execute(cn, "Home/Study/demo");
for(Map<String,Object> row : response.getRows())
{
System.out.println(row.get("ParticipantId") + " weighs " + row.get("APXwtkg"));
}
Command.CommonParameters, Command.Response
_containerFilter, _filters, _maxRows, _offset, _sorts
CONTENT_TYPE_JSON
Constructor and Description |
---|
SelectRowsCommand(SelectRowsCommand source)
Constructs a new SelectRowsCommand that is a copy of the source command
|
SelectRowsCommand(java.lang.String schemaName,
java.lang.String queryName)
Constructs a new SelectRowsCommand for the given schema
and query name.
|
Modifier and Type | Method and Description |
---|---|
SelectRowsCommand |
copy()
Returns a copy of this object.
|
protected SelectRowsResponse |
createResponse(java.lang.String text,
int status,
java.lang.String contentType,
org.json.simple.JSONObject json)
Overridden to create a SelectRowsResponse object.
|
java.util.List<java.lang.String> |
getColumns()
Returns the explicit column list to be requested, or null if the default
set of columns will be requested.
|
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.lang.String |
getQueryName()
Returns the query this command will request.
|
java.lang.String |
getSchemaName()
Returns the current schema name this command will query.
|
java.lang.String |
getViewName()
Returns the current saved view name this command will request.
|
boolean |
isExtendedFormat()
Returns whether the extended format will be requested.
|
void |
setColumns(java.util.List<java.lang.String> columns)
Sets an explicit list of columns to request.
|
void |
setExtendedFormat(boolean extendedFormat)
Set to true to request the extended response format, which includes URLs, Missing-Value indicators and
display values in addition to the raw values.
|
void |
setQueryName(java.lang.String queryName)
Sets the query name this command will request.
|
void |
setSchemaName(java.lang.String schemaName)
Sets the schema name this command will query.
|
void |
setViewName(java.lang.String viewName)
Sets a particular saved view to request.
|
addFilter, addFilter, addSort, addSort, getContainerFilter, getFilters, getMaxRows, getOffset, getQueryParameters, getSorts, setContainerFilter, setFilters, setMaxRows, setOffset, setQueryParameters, setSorts
_execute, checkThrowError, createRequest, execute, getActionName, getActionUrl, getControllerName, getHttpRequest, getParamValueAsString, getQueryString, getRequiredVersion, getTimeout, setParameters, setRequiredVersion, setTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute, getContainerFilter, getMaxRows, getOffset, getRequiredVersion, setContainerFilter, setMaxRows, setOffset, setRequiredVersion
public SelectRowsCommand(java.lang.String schemaName, java.lang.String queryName)
schemaName
- The schema name.queryName
- The query name.public SelectRowsCommand(SelectRowsCommand source)
source
- The source commandpublic void setExtendedFormat(boolean extendedFormat)
extendedFormat
- True to get the extended format.public boolean isExtendedFormat()
public java.lang.String getSchemaName()
public void setSchemaName(java.lang.String schemaName)
schemaName
- The new schema name.public java.lang.String getQueryName()
public void setQueryName(java.lang.String queryName)
queryName
- The new query name.public java.lang.String getViewName()
public void setViewName(java.lang.String viewName)
viewName
- The view name, or null to request the default view.public java.util.List<java.lang.String> getColumns()
public void setColumns(java.util.List<java.lang.String> columns)
columns
- The explicit column list, or null to request the default set of columns.protected SelectRowsResponse createResponse(java.lang.String text, int status, java.lang.String contentType, org.json.simple.JSONObject json)
createResponse
in class Command<SelectRowsResponse>
text
- The response textstatus
- The HTTP status codecontentType
- The Content-Type header value.json
- The parsed JSONObject (or null if JSON was not returned).public java.util.Map<java.lang.String,java.lang.Object> getParameters()
Command
getParameters
in class BaseQueryCommand<SelectRowsResponse>
public SelectRowsCommand copy()
Command
copy
in class Command<SelectRowsResponse>