Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

au.edu.educationau.belts.command
Class CommandResult  view CommandResult download CommandResult.java

java.lang.Object
  extended byau.edu.educationau.belts.command.CommandResult
All Implemented Interfaces:
java.io.Serializable

public class CommandResult
extends java.lang.Object
implements java.io.Serializable

A result of the execution of a command. A CommandResult consists of the outcome, a result object, and an error list.

The outcome is a string which broadly indicates success or failure of the command:

OUTCOME_OK 55

Successful execution.

OUTCOME_VALIDATION_ERROR 55

The parameters supplied to the command were invalid.

OUTCOME_ERROR 55

Unsuccessful execution.

OUTCOME_UNKNOWN 55

Indicates a serious internal error in the command implementation. A command should never return this outcome.

The error list contains a list of CommandError objects which indicate the cause of the error or validation error.

The meaning of the result object is command-specific.

Version:
$Revision: 1.6.4.3 $ - $Date: 2003/06/23 11:22:12 $

Field Summary
private  java.util.List _errors
           
private  java.lang.String _outcome
           
private  java.lang.Object _result
           
static java.lang.String OUTCOME_ERROR
          the outcome when there is a general error processing the command
static java.lang.String OUTCOME_OK
          the outcome when the command executed correctly
static java.lang.String OUTCOME_UNKNOWN
          the default outcome of a command
static java.lang.String OUTCOME_VALIDATION_ERROR
          the outcome when there is a validation error
 
Constructor Summary
CommandResult(java.lang.String outcome, java.lang.Object result, java.util.List errors)
          Create a command result containing the outcome, result and errors passed
 
Method Summary
static CommandResult createSystemError(java.lang.String category, java.lang.String context, java.lang.String message)
           
 java.util.List errors()
          Provides access to the errors of the command; for example it may contain a CommmandError indicating that the id parameter is required.
 boolean hasErrors()
          Indicates if the CommandResult contains errors.
 boolean hasResult()
          Indicates if the CommandResult contains a result.
 java.lang.String outcome()
          Provides access to the outcome of the command; for example "validation-error"
 java.lang.Object result()
          Provides access to the result of the command; for example the time of day as a Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OUTCOME_UNKNOWN

public static final java.lang.String OUTCOME_UNKNOWN
the default outcome of a command

See Also:
Constant Field Values

OUTCOME_VALIDATION_ERROR

public static final java.lang.String OUTCOME_VALIDATION_ERROR
the outcome when there is a validation error

See Also:
Constant Field Values

OUTCOME_ERROR

public static final java.lang.String OUTCOME_ERROR
the outcome when there is a general error processing the command

See Also:
Constant Field Values

OUTCOME_OK

public static final java.lang.String OUTCOME_OK
the outcome when the command executed correctly

See Also:
Constant Field Values

_outcome

private java.lang.String _outcome

_result

private java.lang.Object _result

_errors

private java.util.List _errors
Constructor Detail

CommandResult

public CommandResult(java.lang.String outcome,
                     java.lang.Object result,
                     java.util.List errors)
Create a command result containing the outcome, result and errors passed

Method Detail

createSystemError

public static CommandResult createSystemError(java.lang.String category,
                                              java.lang.String context,
                                              java.lang.String message)

outcome

public java.lang.String outcome()
Provides access to the outcome of the command; for example "validation-error"


result

public java.lang.Object result()
Provides access to the result of the command; for example the time of day as a Date object. The result may be null.


errors

public java.util.List errors()
Provides access to the errors of the command; for example it may contain a CommmandError indicating that the id parameter is required.


hasErrors

public boolean hasErrors()
Indicates if the CommandResult contains errors.


hasResult

public boolean hasResult()
Indicates if the CommandResult contains a result.