getBatchStatusCode
getBatchStatusCode メソッドは、executeBatch メソッドで実行されたコマンドの配列から、最も大きいステータス・コードを返します。
getBatchStatusCode()
戻り値
getBatchStatusCode メソッドは整数を返します。
- 0 - STATUS_SUCCESS - 呼び出されたメソッドはエラーなく完了しました。
- 1 - STATUS_WARNING - 呼び出されたメソッドは 1 つ以上の警告を伴って完了しました (エラーはなし)。
- 2 - STATUS_ERROR - 呼び出されたメソッドは正常に完了しませんでした。1 つ以上のエラーがあります。
例
以下のサンプル・コードは、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());
}
}