org.infoglue.cms.exception
Class ConstraintException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.infoglue.cms.exception.ConstraintException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AccessConstraintException

public class ConstraintException
extends java.lang.Exception

Thrown to indicate that some business rule rule has been violated. Examples include trying to assign non-unique values, illegal syntax, missing values for required fields...

As there is a possibility that more than one rule is validated, ConstraintException can be chained.

Note! This is not an internal exception

Author:
Patrik Nyborg
See Also:
Serialized Form

Constructor Summary
ConstraintException(java.lang.String fieldName, java.lang.String errorCode)
          Construct a ConstraintException with the specified field name and error code.
ConstraintException(java.lang.String fieldName, java.lang.String errorCode, ConstraintException chainedException)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if the specified object is a constraint exception with the same field name and error code.
 ConstraintException getChainedException()
           
 java.lang.String getErrorCode()
           
 java.lang.String getFieldName()
           
 java.lang.String getMessage()
           
 int hashCode()
          Note!
 void setChainedException(ConstraintException chainedException)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstraintException

public ConstraintException(java.lang.String fieldName,
                           java.lang.String errorCode)
Construct a ConstraintException with the specified field name and error code.

Parameters:
fieldName - the name of the (entity) field causing the exception.
errorCode - indicates the error type.

ConstraintException

public ConstraintException(java.lang.String fieldName,
                           java.lang.String errorCode,
                           ConstraintException chainedException)
Method Detail

setChainedException

public void setChainedException(ConstraintException chainedException)

getChainedException

public ConstraintException getChainedException()

getFieldName

public java.lang.String getFieldName()

getErrorCode

public java.lang.String getErrorCode()

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Throwable

equals

public boolean equals(java.lang.Object o)

Returns true if the specified object is a constraint exception with the same field name and error code.

Note! Does not include equals check for any chained exceptions. To check for the, use the ConstraintExceptionBuffer class.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the specified object; false otherwise.

hashCode

public int hashCode()
Note! It is generally necessary to override the hashCode method whenever the equals() method is overridden. Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.