getBatchStatusCode
getBatchStatusCode()
getBatchStatusCode 方法返回 executeBatch 方法执行的一组命令中的最高状态码。
返回值
getBatchStatusCode 方法返回一个整数。
*
*
*
示例
以下代码样本提供了如何检索 BatchStatusCode 的示例。
// Top level status code is a short cut to determine if there are any 
// non-successes in the array of Response objects
if(batchResponse.getBatchStatusCode() == Response.STATUS_SUCCESS)
{
System.out.println("ExecuteBatch ran perfectly!");
}
else if(batchResponse.getBatchStatusCode() == Response.STATUS_WARNING)
{
System.out.println("ExecuteBatch call processed with at least one warning");
}
else
{
System.out.println("ExecuteBatch call processed with at least one error");
}

// Iterate through the array, and print out the message for any non-successes
for(Response response : batchResponse.getResponses())
{
if(response.getStatusCode()!=Response.STATUS_SUCCESS)
{
printDetailMessageOfWarningOrError("executeBatchCommand",
response.getAdvisoryMessages());
}
}