Package org.labkey.remoteapi.query
Class SaveRowsResponse
java.lang.Object
org.labkey.remoteapi.CommandResponse
org.labkey.remoteapi.query.SaveRowsResponse
Response object for the
SaveRowsCommand, containing results of batch operations executed on the server.
This response provides details about the success or failure of each command in the batch, including:
- Whether the transaction was committed
- Number of errors encountered
- Detailed results for each command executed
Example usage:
SaveRowsCommand cmd = new SaveRowsCommand();
// Add commands to insert/update/delete gene annotations...
SaveRowsResponse response = cmd.execute(connection, "GenomeProject");
if (response.isCommitted())
{
for (SaveRowsResponse.Result result : response.getResults())
{
System.out.println(String.format(
"%s operation affected %d rows in %s.%s",
result.getCommand(),
result.getRowsAffected(),
result.getSchemaName(),
result.getQueryName()
));
// For detailed examination of affected rows
for (Map>String, Object> row : result.getRows())
{
System.out.println(String.format(
"Gene %s annotation at position %d-%d",
row.get("geneName"),
row.get("start"),
row.get("end")
));
}
// Check if operation was audited
if (result.getTransactionAuditId() > 0)
{
System.out.println("Audit record created with ID: " +
result.getTransactionAuditId());
}
}
}
else
{
System.out.println("Transaction failed with " +
response.getErrorCount() + " errors");
}
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionSaveRowsResponse(String text, int statusCode, String contentType, org.json.JSONObject json) -
Method Summary
Modifier and TypeMethodDescriptionintbooleanMethods inherited from class org.labkey.remoteapi.CommandResponse
findObject, getContentType, getParsedData, getProperty, getProperty, getStatusCode, getText
-
Constructor Details
-
SaveRowsResponse
-
-
Method Details
-
isCommitted
public boolean isCommitted() -
getErrorCount
public int getErrorCount() -
getResults
-