com.flexive.shared.exceptions
Class FxApplicationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.flexive.shared.exceptions.FxApplicationException
All Implemented Interfaces:
FxLocalizedException, java.io.Serializable
Direct Known Subclasses:
FxConfigException, FxConstraintViolationException, FxConversionException, FxCreateException, FxDbException, FxEntryExistsException, FxEntryInUseException, FxInvalidLanguageException, FxInvalidParameterException, FxInvalidQueryNodeException, FxInvalidStateException, FxLoadException, FxLookupException, FxNoAccessException, FxNotFoundException, FxRemoveException, FxSqlSearchException, FxStreamException, FxTreeException, FxUpdateException

public class FxApplicationException
extends java.lang.Exception
implements FxLocalizedException

Base class for all [fleXive] Exceptions, supports localized messages and converting. Refer to the property files in package com.flexive.shared.exception.messages for keys to use. All property files in this package will be concatenated to one big FxExceptionMessages.properties file upon deployment. If a (not null) Logger is passed as the first argument the message will be logged at level "error" in the default locale (usually english) as well.

Author:
Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
protected  FxExceptionMessage message
          the localized message
 
Constructor Summary
FxApplicationException(FxApplicationException converted)
          Localized exception constructor
FxApplicationException(org.apache.commons.logging.Log log, FxApplicationException converted)
          Localized exception constructor
FxApplicationException(org.apache.commons.logging.Log log, java.lang.String key)
          Localized exception constructor
FxApplicationException(org.apache.commons.logging.Log log, java.lang.String key, java.lang.Object... values)
          Localized exception constructor
FxApplicationException(org.apache.commons.logging.Log log, java.lang.String message, java.lang.Throwable cause)
          Localized exception constructor
FxApplicationException(org.apache.commons.logging.Log log, java.lang.Throwable cause)
          Localized exception constructor
FxApplicationException(org.apache.commons.logging.Log log, java.lang.Throwable cause, java.lang.String key, java.lang.Object... values)
          Localized exception constructor
FxApplicationException(java.lang.String key)
          Localized exception constructor
FxApplicationException(java.lang.String key, java.lang.Object... values)
          Localized exception constructor
FxApplicationException(java.lang.String message, java.lang.Throwable cause)
          Localized exception constructor
FxApplicationException(java.lang.Throwable cause)
          Localized exception constructor
FxApplicationException(java.lang.Throwable cause, java.lang.String key, java.lang.Object... values)
          Localized exception constructor
 
Method Summary
 FxRuntimeException asRuntimeException()
          Wraps this exception in a FxRuntimeException.
 java.lang.String getAffectedXPath()
          Get the XPath that has caused this Exception to be thrown
 FxExceptionMessage getExceptionMessage()
          Get the underlying exception message object
 java.lang.String getMessage()
          Get the localized message in the default locale (english)
 java.lang.String getMessage(FxLanguage locale)
          Get the localized message for a locale
 java.lang.String getMessage(long localeId)
          Get the localized message for a localeId
 java.lang.String getMessage(UserTicket ticket)
          Get the localized message for a calling users locale
 boolean hasAffectedXPath()
          Is this exception related to an XPath?
 boolean isMessageLogged()
          Has the message been logged?
protected  boolean messageLogged()
          Has the message been logged?
 FxApplicationException setAffectedXPath(java.lang.String affectedXPath)
          Set the affected XPath that caused this Exception to be thrown
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

message

protected FxExceptionMessage message
the localized message

Constructor Detail

FxApplicationException

public FxApplicationException(FxApplicationException converted)
Localized exception constructor

Parameters:
converted - the message to convert

FxApplicationException

public FxApplicationException(org.apache.commons.logging.Log log,
                              FxApplicationException converted)
Localized exception constructor

Parameters:
log - Log to use
converted - exception to convert

FxApplicationException

public FxApplicationException(java.lang.String key,
                              java.lang.Object... values)
Localized exception constructor

Parameters:
key - exception messge resource key
values - value parameters for resource message

FxApplicationException

public FxApplicationException(org.apache.commons.logging.Log log,
                              java.lang.String key,
                              java.lang.Object... values)
Localized exception constructor

Parameters:
log - Log to use
key - exception messge resource key
values - value parameters for resource message

FxApplicationException

public FxApplicationException(java.lang.Throwable cause,
                              java.lang.String key,
                              java.lang.Object... values)
Localized exception constructor

Parameters:
cause - causing exception
key - exception messge resource key
values - value parameters for resource message

FxApplicationException

public FxApplicationException(org.apache.commons.logging.Log log,
                              java.lang.Throwable cause,
                              java.lang.String key,
                              java.lang.Object... values)
Localized exception constructor

Parameters:
log - Log to use
cause - causing message
key - exception messge resource key
values - value parameters for resource message

FxApplicationException

public FxApplicationException(java.lang.String key)
Localized exception constructor

Parameters:
key - exception messge resource key

FxApplicationException

public FxApplicationException(org.apache.commons.logging.Log log,
                              java.lang.String key)
Localized exception constructor

Parameters:
log - Log to use
key - exception messge resource key

FxApplicationException

public FxApplicationException(java.lang.String message,
                              java.lang.Throwable cause)
Localized exception constructor

Parameters:
message - resource key
cause - causing exception

FxApplicationException

public FxApplicationException(org.apache.commons.logging.Log log,
                              java.lang.String message,
                              java.lang.Throwable cause)
Localized exception constructor

Parameters:
log - Log to use
message - resource key
cause - exception cause

FxApplicationException

public FxApplicationException(java.lang.Throwable cause)
Localized exception constructor

Parameters:
cause - exception cause

FxApplicationException

public FxApplicationException(org.apache.commons.logging.Log log,
                              java.lang.Throwable cause)
Localized exception constructor

Parameters:
log - Log to use
cause - causing exception
Method Detail

messageLogged

protected boolean messageLogged()
Has the message been logged?

Returns:
message logged

getAffectedXPath

public java.lang.String getAffectedXPath()
Get the XPath that has caused this Exception to be thrown

Returns:
affected XPath or empty String if not XPath related

hasAffectedXPath

public boolean hasAffectedXPath()
Is this exception related to an XPath?

Returns:
exception related to an XPath

setAffectedXPath

public FxApplicationException setAffectedXPath(java.lang.String affectedXPath)
Set the affected XPath that caused this Exception to be thrown

Parameters:
affectedXPath - XPath that caused this Exception to be thrown
Returns:
this

isMessageLogged

public boolean isMessageLogged()
Has the message been logged?

Returns:
message logged

getMessage

public final java.lang.String getMessage()
Get the localized message in the default locale (english)

Specified by:
getMessage in interface FxLocalizedException
Overrides:
getMessage in class java.lang.Throwable
Returns:
localized message

getMessage

public java.lang.String getMessage(FxLanguage locale)
Get the localized message for a locale

Specified by:
getMessage in interface FxLocalizedException
Parameters:
locale - locale to get the message got
Returns:
localized message

getMessage

public java.lang.String getMessage(long localeId)
Get the localized message for a localeId

Specified by:
getMessage in interface FxLocalizedException
Parameters:
localeId - locale id to get the message for
Returns:
localized message

getMessage

public java.lang.String getMessage(UserTicket ticket)
Get the localized message for a calling users locale

Specified by:
getMessage in interface FxLocalizedException
Parameters:
ticket - calling users ticket, used to get the locale for the message from
Returns:
localized message

getExceptionMessage

public FxExceptionMessage getExceptionMessage()
Get the underlying exception message object

Specified by:
getExceptionMessage in interface FxLocalizedException
Returns:
underlying exception message object

asRuntimeException

public FxRuntimeException asRuntimeException()
Wraps this exception in a FxRuntimeException.

Returns:
this exception wrapped in a FxRuntimeException.