executeBatch(String sessionID, CommandImpl[] Befehle)
![]() |
sessionID-Eine Zeichenfolge zur Identifizierung der Sitzungs-ID. Diese Sitzungs-ID wird für alle Befehle verwendet, die dieser Methodenaufruf ausführt.
|
![]() |
commandImpl[] - Ein Array aus CommandImpl-Objekten, jeweils eins für jeden Befehl, der ausgeführt werden soll.
|
/** Define all variables for all members of the executeBatch*/
String sessionId="MySessionID-123";
String interactionPoint = "Overview Page Banner 1";
int numberRequested=1;
String eventName = "logOffer";
/** build the getOffers command */
Command getOffersCommand = new CommandImpl();
getOffersCommand.setMethodIdentifier(Command.COMMAND_GETOFFERS);
getOffersCommand.setInteractionPoint(interactionPoint);
getOffersCommand.setNumberRequested(numberRequested);
/** build the postEvent command */
Command postEventCommand = new CommandImpl();
postEventCommand.setMethodIdentifier(Command.COMMAND_POSTEVENT);
postEventCommand.setEventParameters(postEventParameters);
postEventCommand.setEvent(eventName);
/** Build command array */
Command[] commands =
{
getOffersCommand,
postEventCommand,
};
/** Make the call */
BatchResponse batchResponse = api.executeBatch(sessionId, commands);
/** Process the response appropriately */
// 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 2014. All Rights Reserved.
|