Package org.nuclos.api.exception
Class BusinessException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.nuclos.api.exception.BusinessException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
PointerException
BusinessException is a general exception class for checked
exceptions in (user provided) business rules.
If a BusinessException is thrown from a (server) business rule, it is guaranteed that the exception message text is displayed to the nuclos client GUI user.
This class is used to display business process problems triggered by business rule execution to the client user.
- Author:
- Matthias Reichart
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
for deserialization onlyBusinessException
(boolean pTranslateAndRememberWithGeneratedKey, String pMessage) Creates a new BusinessException with a message.BusinessException
(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, Throwable pThrowable) Creates a new BusinessException with the specified message and cause.BusinessException
(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, Locale pSourceLocale) Creates a new BusinessException with the specified translation option for a specific locale.BusinessException
(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, Locale pSourceLocale, Throwable pThrowable) Creates a new BusinessException with the specified message, locale, and cause.BusinessException
(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, NuclosLocale pSourceLocale) Creates a new BusinessException with the specified translation option for a specific Nuclos locale.BusinessException
(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, NuclosLocale pSourceLocale, Throwable pThrowable) Creates a new BusinessException with the specified message, Nuclos locale, and cause.BusinessException
(String pMessage) Creates a new BusinessException with a messageBusinessException
(String pKey, String pMessage) Creates a new BusinessException with the specified localization key and message.BusinessException
(String pKey, String pMessage, Locale pSourceLocale) Creates a new BusinessException with the specified localization key, message, and locale.BusinessException
(String pKey, String pMessage, NuclosLocale pSourceLocale) Creates a new BusinessException with the specified localization key, message, and Nuclos locale.BusinessException
(String pMessage, Throwable pThrowable) Constructor to initiate the new NuclosBusinessException with an object of type Throwable and an error messageBusinessException
(Throwable pThrowable) Constructor to initiate the new NuclosBusinessException with an object of type ThrowableBusinessException
(DoNotTranslate pMessage) Creates a new BusinessException with a message that is not translated.BusinessException
(DoNotTranslate pMessage, Throwable pThrowable) Creates a new BusinessException with a message that is not translated and the specified cause. -
Method Summary
Modifier and TypeMethodDescriptionstatic BusinessException
doNotTranslate
(String pMessage) Creates a new BusinessException with a message that is not translated.static BusinessException
doNotTranslate
(String pMessage, Throwable pThrowable) Creates a new BusinessException with a message that is not translated and the specified cause.protected static String
getMessage
(Throwable cause) This method returns the message that is used in the parameter cause of type ThrowableAdds message arguments to this exception that will be used for message formatting.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
BusinessException
protected BusinessException()for deserialization only -
BusinessException
Creates a new BusinessException with a message- Parameters:
pMessage
-
-
BusinessException
Creates a new BusinessException with a message that is not translated.- Parameters:
pMessage
- The error message that should not be translated
-
BusinessException
Creates a new BusinessException with a message.- Parameters:
pTranslateAndRememberWithGeneratedKey
- If true, translate and remember with a generated keypMessage
- The error message
-
BusinessException
public BusinessException(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, Locale pSourceLocale) Creates a new BusinessException with the specified translation option for a specific locale.- Parameters:
pTranslateAndRememberWithGeneratedKey
- If true, translate and remember with a generated keypMessage
- The error messagepSourceLocale
- The locale of the text
-
BusinessException
public BusinessException(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, NuclosLocale pSourceLocale) Creates a new BusinessException with the specified translation option for a specific Nuclos locale.- Parameters:
pTranslateAndRememberWithGeneratedKey
- If true, translate and remember with a generated keypMessage
- The error messagepSourceLocale
- The NuclosLocale of the text
-
BusinessException
Creates a new BusinessException with the specified localization key and message.- Parameters:
pKey
- The localization keypMessage
- The error message
-
BusinessException
Creates a new BusinessException with the specified localization key, message, and locale.- Parameters:
pKey
- The localization keypMessage
- The error messagepSourceLocale
- The locale of the text
-
BusinessException
Creates a new BusinessException with the specified localization key, message, and Nuclos locale.- Parameters:
pKey
- The localization keypMessage
- The error messagepSourceLocale
- The NuclosLocale of the text
-
BusinessException
Constructor to initiate the new NuclosBusinessException with an object of type Throwable- Parameters:
pThrowable
-
-
BusinessException
Constructor to initiate the new NuclosBusinessException with an object of type Throwable and an error message- Parameters:
pThrowable
-
-
BusinessException
public BusinessException(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, Throwable pThrowable) Creates a new BusinessException with the specified message and cause.- Parameters:
pTranslateAndRememberWithGeneratedKey
- If true, translate and remember with a generated keypMessage
- The error messagepThrowable
- The cause of this exception
-
BusinessException
public BusinessException(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, Locale pSourceLocale, Throwable pThrowable) Creates a new BusinessException with the specified message, locale, and cause.- Parameters:
pTranslateAndRememberWithGeneratedKey
- If true, translate and remember with a generated keypMessage
- The error messagepSourceLocale
- The locale of the textpThrowable
- The cause of this exception
-
BusinessException
public BusinessException(boolean pTranslateAndRememberWithGeneratedKey, String pMessage, NuclosLocale pSourceLocale, Throwable pThrowable) Creates a new BusinessException with the specified message, Nuclos locale, and cause.- Parameters:
pTranslateAndRememberWithGeneratedKey
- If true, translate and remember with a generated keypMessage
- The error messagepSourceLocale
- The NuclosLocale of the textpThrowable
- The cause of this exception
-
BusinessException
Creates a new BusinessException with a message that is not translated and the specified cause.- Parameters:
pMessage
- The error message that should not be translatedpThrowable
- The cause of this exception
-
-
Method Details
-
doNotTranslate
Creates a new BusinessException with a message that is not translated.- Parameters:
pMessage
- The error message that should not be translated- Returns:
- A new BusinessException instance with an untranslated message
-
doNotTranslate
Creates a new BusinessException with a message that is not translated and the specified cause.- Parameters:
pMessage
- The error message that should not be translatedpThrowable
- The cause of this exception- Returns:
- A new BusinessException instance with an untranslated message and the specified cause
-
getMessage
This method returns the message that is used in the parameter cause of type Throwable- Parameters:
cause
-- Returns:
-
withArgs
Adds message arguments to this exception that will be used for message formatting.- Parameters:
pArgs
- The arguments to use when formatting the exception message- Returns:
- This exception instance for method chaining
-
getMessage
- Overrides:
getMessage
in classThrowable
-