Class BusinessException

java.lang.Object
java.lang.Throwable
java.lang.Exception
org.nuclos.api.exception.BusinessException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PointerException

public class BusinessException extends Exception
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 Details

    • BusinessException

      protected BusinessException()
      for deserialization only
    • BusinessException

      public BusinessException(String pMessage)
      Creates a new BusinessException with a message
      Parameters:
      pMessage -
    • BusinessException

      public BusinessException(DoNotTranslate pMessage)
      Creates a new BusinessException with a message that is not translated.
      Parameters:
      pMessage - The error message that should not be translated
    • BusinessException

      public BusinessException(boolean pTranslateAndRememberWithGeneratedKey, String pMessage)
      Creates a new BusinessException with a message.
      Parameters:
      pTranslateAndRememberWithGeneratedKey - If true, translate and remember with a generated key
      pMessage - 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 key
      pMessage - The error message
      pSourceLocale - 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 key
      pMessage - The error message
      pSourceLocale - The NuclosLocale of the text
    • BusinessException

      public BusinessException(String pKey, String pMessage)
      Creates a new BusinessException with the specified localization key and message.
      Parameters:
      pKey - The localization key
      pMessage - The error message
    • BusinessException

      public BusinessException(String pKey, String pMessage, Locale pSourceLocale)
      Creates a new BusinessException with the specified localization key, message, and locale.
      Parameters:
      pKey - The localization key
      pMessage - The error message
      pSourceLocale - The locale of the text
    • BusinessException

      public BusinessException(String pKey, String pMessage, NuclosLocale pSourceLocale)
      Creates a new BusinessException with the specified localization key, message, and Nuclos locale.
      Parameters:
      pKey - The localization key
      pMessage - The error message
      pSourceLocale - The NuclosLocale of the text
    • BusinessException

      public BusinessException(Throwable pThrowable)
      Constructor to initiate the new NuclosBusinessException with an object of type Throwable
      Parameters:
      pThrowable -
    • BusinessException

      public BusinessException(String pMessage, Throwable pThrowable)
      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 key
      pMessage - The error message
      pThrowable - 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 key
      pMessage - The error message
      pSourceLocale - The locale of the text
      pThrowable - 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 key
      pMessage - The error message
      pSourceLocale - The NuclosLocale of the text
      pThrowable - The cause of this exception
    • BusinessException

      public BusinessException(DoNotTranslate pMessage, Throwable pThrowable)
      Creates a new BusinessException with a message that is not translated and the specified cause.
      Parameters:
      pMessage - The error message that should not be translated
      pThrowable - The cause of this exception
  • Method Details

    • doNotTranslate

      public static BusinessException doNotTranslate(String pMessage)
      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

      public static BusinessException doNotTranslate(String pMessage, Throwable pThrowable)
      Creates a new BusinessException with a message that is not translated and the specified cause.
      Parameters:
      pMessage - The error message that should not be translated
      pThrowable - The cause of this exception
      Returns:
      A new BusinessException instance with an untranslated message and the specified cause
    • getMessage

      protected static String getMessage(Throwable cause)
      This method returns the message that is used in the parameter cause of type Throwable
      Parameters:
      cause -
      Returns:
    • withArgs

      public BusinessException withArgs(Object... pArgs)
      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

      public String getMessage()
      Overrides:
      getMessage in class Throwable