com.jaxfront.core.schema
Class ValidationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.jaxfront.core.schema.ValidationException
All Implemented Interfaces:
java.io.Serializable

public class ValidationException
extends java.lang.Exception

This exception is thrown if setting a value to a JAXFront type violates a XML Schema facet restriction, a cardinality restriction or a user defined cross field validation (xui rule).

Version:
1.60
See Also:
SimpleType.validate(String,boolean), Serialized Form

Field Summary
static int CARDINALITY_EXCEPTION
           
static int DUPLICATE_ID_EXCEPTION
           
static int DUPLICATE_KEY_EXCEPTION
           
static int EXCEPTION_NOT_DEFINED
           
static int INVALID_CODESET_EXCEPTION
           
static int LIST_ADD_ENTRY
           
static int LIST_NO_CHANGE
           
static int LIST_REMOVE_ENTRY
           
static int MANDATORY_EXCEPTION
           
static int MISSING_KEY_EXCEPTION
           
 
Constructor Summary
ValidationException(ConditionExpression condition)
          Creates a ValidationException based on a Condition.
ValidationException(Type source)
          Creates a ValidationException based on user specific message.
ValidationException(Type source, boolean needingUserAcceptance)
          Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.
ValidationException(Type source, boolean needingUserAcceptance, boolean showDialog)
          Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.
ValidationException(Type source, boolean needingUserAcceptance, boolean showDialog, boolean isMandatoryException)
          Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.
ValidationException(Type source, boolean needingUserAcceptance, boolean showDialog, boolean isMandatoryException, java.lang.String classification)
          Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.
ValidationException(Type source, java.lang.Exception e, java.lang.String classification)
          Creates a ValidationException based on a nested exception.
ValidationException(Type source, java.lang.String messageText, boolean needingUserAcceptance, boolean showDialog, boolean isMandatoryException, java.lang.String classification)
          Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.
 
Method Summary
static ValidationException createCardinalityException(ListType type)
          Factory method to create a cardinality violation exception.
static ValidationException createDuplicateIDException(SimpleType type, java.lang.String invalidValue)
          Factory method to create a duplicate ID exception.
static ValidationException createDuplicateKeyException(SimpleType type, java.lang.String invalidValue)
          Factory method to create a duplicate key exception.
static ValidationException createInvalidCodeSetCodeException(SimpleType type, java.lang.String invalidValue)
          Factory method to create an invalid codeset value exception.
static ValidationException createMandatoryException(Type type)
          Factory method to create a mandatory violation exception.
static ValidationException createMissingKeyException(SimpleType type, java.lang.String invalidValue)
          Factory method to create a duplicate key exception.
 java.lang.String getClassification()
          Returns the classification of this exception.
 ConditionExpression getCondition()
          Returns the underlying condition or null;
 int getExceptionType()
           
 java.lang.String getMessage()
          Returns the validation text message.
 java.lang.Exception getOccuredException()
           
 Type getSource()
           
 boolean isCardinalityException()
          Returns true if this is a cardinality violation exception.
 boolean isDuplicateIDException()
          Returns true if this is a cardinality violation exception.
 boolean isDuplicateKeyException()
          Returns true if this is a cardinality violation exception.
 boolean isMandatoryException()
          Returns true if this is a mandatory violation exception.
 boolean isMissingKeyException()
          Returns true if this is a mandatory violation exception.
 boolean isNeedingUserAcceptance()
          Indicates if a validation exception needs a user commitment.
 boolean isShowingDialog()
          Returns true if this exception should be shown in a dialog when catched.
 void setClassification(java.lang.String classification)
          Sets the classification for this exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXCEPTION_NOT_DEFINED

public static final int EXCEPTION_NOT_DEFINED
See Also:
Constant Field Values

MANDATORY_EXCEPTION

public static final int MANDATORY_EXCEPTION
See Also:
Constant Field Values

CARDINALITY_EXCEPTION

public static final int CARDINALITY_EXCEPTION
See Also:
Constant Field Values

DUPLICATE_KEY_EXCEPTION

public static final int DUPLICATE_KEY_EXCEPTION
See Also:
Constant Field Values

MISSING_KEY_EXCEPTION

public static final int MISSING_KEY_EXCEPTION
See Also:
Constant Field Values

INVALID_CODESET_EXCEPTION

public static final int INVALID_CODESET_EXCEPTION
See Also:
Constant Field Values

DUPLICATE_ID_EXCEPTION

public static final int DUPLICATE_ID_EXCEPTION
See Also:
Constant Field Values

LIST_NO_CHANGE

public static final int LIST_NO_CHANGE
See Also:
Constant Field Values

LIST_ADD_ENTRY

public static final int LIST_ADD_ENTRY
See Also:
Constant Field Values

LIST_REMOVE_ENTRY

public static final int LIST_REMOVE_ENTRY
See Also:
Constant Field Values
Constructor Detail

ValidationException

public ValidationException(ConditionExpression condition)
Creates a ValidationException based on a Condition.

Parameters:
condition - condition which caused a ValidationException

ValidationException

public ValidationException(Type source,
                           boolean needingUserAcceptance,
                           boolean showDialog,
                           boolean isMandatoryException,
                           java.lang.String classification)
Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.

Parameters:
source - exception source
classification - the classification of the message (e.g. warning, hint, information,...)
showDialog - if true, the message will be shown in a dialog
needingUserAceptance - a flag saying if this validation exception needs a user commitment
isMandatoryException - a flag saying if this validation is a mandatory exception

ValidationException

public ValidationException(Type source,
                           boolean needingUserAcceptance,
                           boolean showDialog,
                           boolean isMandatoryException)
Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.

Parameters:
source - exception source
showDialog - if true, the message will be shown in a dialog
needingUserAceptance - a flag saying if this validation exception needs a user commitment
isMandatoryException - a flag saying if this validation is a mandatory exception

ValidationException

public ValidationException(Type source,
                           boolean needingUserAcceptance,
                           boolean showDialog)
Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.

Parameters:
source - exception source
showDialog - true if the message should be displayed in a dialog
needingUserAceptance - a flag saying if this validation exception needs a user commitment

ValidationException

public ValidationException(Type source,
                           boolean needingUserAcceptance)
Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.

Parameters:
source - exception source
needingUserAceptance - a flag saying if this validation exception needs a user commitment

ValidationException

public ValidationException(Type source,
                           java.lang.Exception e,
                           java.lang.String classification)
Creates a ValidationException based on a nested exception.

Parameters:
e - nested validation exception
classification - validation classification

ValidationException

public ValidationException(Type source,
                           java.lang.String messageText,
                           boolean needingUserAcceptance,
                           boolean showDialog,
                           boolean isMandatoryException,
                           java.lang.String classification)
Creates a ValidationException based on a user specific text message and a flag saying that the occurance of this exception needs a user commitment.

Parameters:
source - exception source
messageText - message text
classification - the classification of the message (e.g. warning, hint, information,...)
showDialog - if true, the message will be shown in a dialog
needingUserAceptance - a flag saying if this validation exception needs a user commitment
isMandatoryException - a flag saying if this validation is a mandatory exception

ValidationException

public ValidationException(Type source)
Creates a ValidationException based on user specific message.

Parameters:
source - exception source
Method Detail

createMandatoryException

public static ValidationException createMandatoryException(Type type)
Factory method to create a mandatory violation exception.

Parameters:
type - source type

createCardinalityException

public static ValidationException createCardinalityException(ListType type)
Factory method to create a cardinality violation exception.

Parameters:
type - source type

createInvalidCodeSetCodeException

public static ValidationException createInvalidCodeSetCodeException(SimpleType type,
                                                                    java.lang.String invalidValue)
Factory method to create an invalid codeset value exception.

Parameters:
type - source type
text - message text

createDuplicateKeyException

public static ValidationException createDuplicateKeyException(SimpleType type,
                                                              java.lang.String invalidValue)
Factory method to create a duplicate key exception.

Parameters:
type - source type
invalidValue - invalid key

createMissingKeyException

public static ValidationException createMissingKeyException(SimpleType type,
                                                            java.lang.String invalidValue)
Factory method to create a duplicate key exception.

Parameters:
type - source type
invalidValue - invalid key

createDuplicateIDException

public static ValidationException createDuplicateIDException(SimpleType type,
                                                             java.lang.String invalidValue)
Factory method to create a duplicate ID exception.

Parameters:
type - source type
invalidValue - invalid key

getCondition

public ConditionExpression getCondition()
Returns the underlying condition or null;


getMessage

public java.lang.String getMessage()
Returns the validation text message.

Overrides:
getMessage in class java.lang.Throwable

isNeedingUserAcceptance

public boolean isNeedingUserAcceptance()
Indicates if a validation exception needs a user commitment.


isMandatoryException

public boolean isMandatoryException()
Returns true if this is a mandatory violation exception.


isCardinalityException

public boolean isCardinalityException()
Returns true if this is a cardinality violation exception.


isMissingKeyException

public boolean isMissingKeyException()
Returns true if this is a mandatory violation exception.


isDuplicateKeyException

public boolean isDuplicateKeyException()
Returns true if this is a cardinality violation exception.


isDuplicateIDException

public boolean isDuplicateIDException()
Returns true if this is a cardinality violation exception.


getExceptionType

public int getExceptionType()

isShowingDialog

public boolean isShowingDialog()
Returns true if this exception should be shown in a dialog when catched.


getClassification

public java.lang.String getClassification()
Returns the classification of this exception.

See Also:
Message.#getClassification()

setClassification

public void setClassification(java.lang.String classification)
Sets the classification for this exception.

Parameters:
classification -

getOccuredException

public java.lang.Exception getOccuredException()

getSource

public Type getSource()