blackboard.data
Class ValidationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by blackboard.data.ValidationException
All Implemented Interfaces:
java.io.Serializable

public class ValidationException
extends java.lang.Exception

This exception is thrown to indicate that a data object has invalid or corrupt data. It is generally thrown by persisters or loaders. UI validation should prevent this exception from appearing in application code, but in many cases, validation is not guaranteed to occur on inbound data (such as an import feed).

Since:
Bb 5.5
See Also:
Serialized Form

Constructor Summary
ValidationException()
          Default constructor.
ValidationException(java.lang.String str)
          Constructs a ValidationException with the given message.
ValidationException(java.util.Vector<ValidationWarning> warnings)
          Creates a ValidationException with a list of warnings.
 
Method Summary
 void addConstraintViolations(java.lang.String errorMsgKey, blackboard.platform.validation.ConstraintViolation[] violations, blackboard.platform.intl.BbResourceBundle resourceBundle)
          Adds constraint violations to the exception.
 void addWarning(java.lang.String error, java.lang.String constraint)
          Adds a warning to this exception.
 void addWarning(ValidationWarning vw)
          Adds a warning to this exception.
 java.lang.String getMessage()
          Gets the message associated with this exception and a list of all the attached warnings.
 java.util.Vector<ValidationWarning> getWarnings()
          Returns a list of the warnings attached to this exception.
 void include(ValidationException ve)
          Provides ability to chain ValidationExceptions that are spawned in seperate method calls but share a line of processing.
 java.lang.String toString()
          For now simply wraps getMessage()
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValidationException

public ValidationException()
Default constructor.


ValidationException

public ValidationException(java.lang.String str)
Constructs a ValidationException with the given message.

Parameters:
str - Message to include in the exception

ValidationException

public ValidationException(java.util.Vector<ValidationWarning> warnings)
Creates a ValidationException with a list of warnings.

Parameters:
warnings - Vector of warning objects to attach to this exception. Replaces any vector already associated.
Method Detail

getWarnings

public java.util.Vector<ValidationWarning> getWarnings()
Returns a list of the warnings attached to this exception.


include

public void include(ValidationException ve)
Provides ability to chain ValidationExceptions that are spawned in seperate method calls but share a line of processing.


addWarning

public void addWarning(java.lang.String error,
                       java.lang.String constraint)
Adds a warning to this exception. The warnings may be used to communicate to the user what pieces of data are invalid on the data object.

Parameters:
error - an error string stating what went wrong (generic)
constraint - the field specific constrint that was violated

addWarning

public void addWarning(ValidationWarning vw)
Adds a warning to this exception. The warnings may be used to communicate to the user what pieces of data are invalid on the data object.

Parameters:
vw - warning to add

addConstraintViolations

public void addConstraintViolations(java.lang.String errorMsgKey,
                                    blackboard.platform.validation.ConstraintViolation[] violations,
                                    blackboard.platform.intl.BbResourceBundle resourceBundle)
Adds constraint violations to the exception.

Parameters:
errorMsgKey - Error string stating what went wrong (generic)
violations - Violations to add (if null, no warnings will be added)
resourceBundle - Bundle containing the resources referenced by the violations

getMessage

public java.lang.String getMessage()
Gets the message associated with this exception and a list of all the attached warnings.

Overrides:
getMessage in class java.lang.Throwable
Returns:
String including the message and all warnings, separated by platform-specific line separators.

toString

public java.lang.String toString()
For now simply wraps getMessage()

Overrides:
toString in class java.lang.Throwable
Returns:
getMessage()


Copyright 2011 Blackboard, Inc. All Rights Reserved.