getBatchStatusCode
getBatchStatusCode()
getBatchStatusCode
메소드는
executeBatch
메소드에 의해 실행된 명령 배열에서 최상위 상태 코드를 리턴합니다.
리턴값
getBatchStatusCode
메소드는 정수를 리턴합니다.
0 - STATUS_SUCCESS - 호출된 메소드가 오류 없이 완료되었습니다.
1 - STATUS_WARNING - 호출된 메소드가 완료되고 한 개 이상의 경고가 표시됩니다(오류 없음).
2 - STATUS_ERROR - 호출된 메소드가 완료되지 않았으며 한 개 이상의 오류가 있습니다.
예제
다음 코드 샘플은
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());
}
}
Copyright IBM Corporation 2012. All Rights Reserved.