Class SaveRowsResponse

java.lang.Object
org.labkey.remoteapi.CommandResponse
org.labkey.remoteapi.query.SaveRowsResponse

public class SaveRowsResponse extends CommandResponse
Response object used for commands that derive from SaveRowsCommand. This response object provides helper methods for accessing the important bits of the parsed response data.
  • Constructor Details

    • SaveRowsResponse

      public SaveRowsResponse(String text, int statusCode, String contentType, org.json.JSONObject json, HasRequiredVersion hasRequiredVersion)
      Constructs a new SaveRowsResponse given the response text and 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 JSON was not returned)
      hasRequiredVersion - An object that implements HasRequiredVersion
  • Method Details

    • getRowsAffected

      public Number getRowsAffected()
      Returns the 'rowsAffected' response property.
      Returns:
      The number of rows affected by the command, or null if this property was not present in the response.
    • getSchemaName

      public String getSchemaName()
      Returns the 'schemaName' response property.
      Returns:
      The schema name affected by the command, or null if this property was not present in the response.
    • getQueryName

      public String getQueryName()
      Returns the 'queryName' response property.
      Returns:
      The query name affected by the command, or null if this property was not present in the response.
    • getCommand

      public String getCommand()
      Returns the 'command' response property.
      Returns:
      The command executed, or null if this property was not present in the response.
    • getRows

      public List<Map<String,Object>> getRows()
      Returns the list of rows from the parsed response data. Note that numbers in the map values will be either of type Double or type Long depending on the presence of a decimal point. The most reliable way to work with them is to use the Number class. For example:
      
       for (Map<String, Object> row : response.getRows())
       {
           Number key = (Number)row.get("Key");
           // use Number.intValue(), doubleValue(), longValue(), etc to get various primitive types
       }
       
      Returns:
      The list of rows (each row is a Map), or null if the rows list was not included in the response.