com.cisco.provisioning.cpe
Interface BatchStatus

All Superinterfaces:
ProvAPIStatus

public interface BatchStatus
extends ProvAPIStatus

A BatchStatus object contains the CommandStatus objects that contain results from a processed batch. It also contains a status code and error message (for failed batches) indicating whether the batch succeeded (database reflects changes that were specified by the batch) or failed (database does not reflect any changes that were specified by the batch). The BatchStatusCode interface specifies constants for the various error conditions that can be returned from a batch.


Method Summary
 String getBatchID()
          Returns the batch ID for batch this BatchStatus was created for.
 int getCommandCount()
          Gets the number of commands that were associated with the original batch.
 CommandStatus getCommandStatus(int index)
          Gets the specified CommandStatus object.
 int getFailedCommandIndex()
          Gets the index of the CommandStatus object that caused the batch to fail.
 CommandStatus getFailedCommandStatus()
          Gets the CommandStatus object that caused the batch to fail.
 String getWarningMessage()
          Gets warning message describing the issue encountered.
 boolean isWarning()
          Helper method.
 boolean wasBatchReliable()
          Returns true if the batch was treated as reliable by the server.
 
Methods inherited from interface com.cisco.provisioning.cpe.ProvAPIStatus
getErrorMessage, getStatusCode, getStatusType, isError, isSystemError
 

Method Detail

isWarning

boolean isWarning()
Helper method. It will determine whether a status code is a warning message (status code is BatchStatusCode.BATCH_WARNING which has the int value -1). A batch that returned a warning was processed successfully, but some non-critical aspect of the batch could not be completed before returning the results of the batch. Use the BatchStatus.getWarningMessage method on the batch for more details on the warning. Note: Unlike with an error, a warning indicates the batch was processed and the changed performed by the batch are reflected in the RDU database.

Returns:
true if status code is -1. Otherwise false

getBatchID

String getBatchID()
Returns the batch ID for batch this BatchStatus was created for.

Specified by:
getBatchID in interface ProvAPIStatus
Returns:
the associated BatchID for this BatchStatus.

getCommandCount

int getCommandCount()
Gets the number of commands that were associated with the original batch. This BatchStatus object contains one CommandStatus object for each method that was called on the original batch.

Returns:
the number of CommandStatus object contained in this BatchStatus

getCommandStatus

CommandStatus getCommandStatus(int index)
Gets the specified CommandStatus object. The the CommandStatus object are in the same order as the methods were called on the original Batch that was posted.

Parameters:
index - the index of the desired CommandStatus object to retrieve

Returns:
the CommandStatus for the indicated command. If the index does not correspond to a command status of this batch, then null is returned.

getFailedCommandIndex

int getFailedCommandIndex()
Gets the index of the CommandStatus object that caused the batch to fail.

Note: Not all failed batches will fail because of a command. If the batch fails because of another reason, such as mixing query and non-query methods on the same batch or having an invalid set of ActivationMode, ConfirmationMode, and/or PublishingMode flags, then this method will return -1

Returns:
the 0-based index within the Batch of the failed command. If the batch failed because of a batch-level error rather than a failed command, then -1 is returned.

getFailedCommandStatus

CommandStatus getFailedCommandStatus()
Gets the CommandStatus object that caused the batch to fail.

Note: Not all failed batches will fail because of a command. If the batch fails because of another reason, such as mixing query and non-query methods on the same batch or having an invalid set of ActivationMode, ConfirmationMode, and/or PublishingMode flags, then this method will return null

Returns:
the CommandStatus of the failed command. If the batch failed because of a batch-level error rather than a failed command, then null is returned.

wasBatchReliable

boolean wasBatchReliable()
Returns true if the batch was treated as reliable by the server. This value is the same as the return from the Batch.isBatchReliable method on the batch associated with the BatchStatus.

Returns:
if the batch was reliable.

getWarningMessage

String getWarningMessage()
Gets warning message describing the issue encountered. A batch that returned a warning was processed successfully, but some non-critical aspect of the batch could not be completed before returning the results of the batch. This method returnes a detailed description.

Returns:
Warning message describing the problem encountered. If isWarning is not true, then null is returned.