public void executeBatch ( BatchOperation batchOperation ) throws FMSException { IntuitMessage intuitMessage = prepareBatch ( batchOperation ) ; //execute interceptors executeInterceptors ( intuitMessage ) ; IntuitResponse intuitResponse = ( IntuitResponse ) intuitMessage . getResponseElements ( ) . getResponse ( ) ; if ( intuitResponse != null ) { List < BatchItemResponse > batchItemResponses = intuitResponse . getBatchItemResponse ( ) ; if ( batchItemResponses != null && ! batchItemResponses . isEmpty ( ) ) { int count = 0 ; Iterator < BatchItemResponse > itr = batchItemResponses . iterator ( ) ; while ( itr . hasNext ( ) ) { BatchItemResponse batchItemResponse = itr . next ( ) ; String bId = batchItemResponse . getBId ( ) ; if ( ! StringUtils . hasText ( bId ) ) { bId = batchOperation . getBatchItemRequests ( ) . get ( count ) . getBId ( ) ; } if ( batchItemResponse . getFault ( ) != null ) { // segregate fault batch items batchOperation . getFaultResult ( ) . put ( bId , batchItemResponse . getFault ( ) ) ; } else if ( batchItemResponse . getReport ( ) != null ) { // segregate report batch items batchOperation . getReportResult ( ) . put ( bId , batchItemResponse . getReport ( ) ) ; } else if ( batchItemResponse . getIntuitObject ( ) != null ) { // segregate entity batch items batchOperation . getEntityResult ( ) . put ( bId , ( IEntity ) batchItemResponse . getIntuitObject ( ) . getValue ( ) ) ; } else if ( batchItemResponse . getQueryResponse ( ) != null ) { // segregate query batch items QueryResult queryResult = getQueryResult ( batchItemResponse . getQueryResponse ( ) ) ; batchOperation . getQueryResult ( ) . put ( bId , queryResult ) ; } else if ( batchItemResponse . getCDCResponse ( ) != null ) { // segregate cdc query batch items CDCQueryResult cdcQueryResult = getCDCQueryResult ( batchItemResponse . getCDCResponse ( ) ) ; batchOperation . getCDCQueryResult ( ) . put ( bId , cdcQueryResult ) ; } else { LOG . warn ( "BatchItemResponse is not Fault, Entity, Query and Report." ) ; } count ++ ; } } } }
Method to execute the batch operation