Class SmartServiceException.Builder

java.lang.Object
com.appiancorp.suiteapi.process.exceptions.SmartServiceException.Builder
Direct Known Subclasses:
RetryableSmartServiceException.Builder
Enclosing class:
SmartServiceException

public static class SmartServiceException.Builder extends Object
The Builder inner class is used to create an instance of the SmartServiceException. Pass the class that is throwing the SmartServiceException and the Throwable that caused the exception to the constructor, then set the userMessage, then build. See the example in the main class javadoc.
  • Constructor Details

    • Builder

      public Builder(Class smartServiceClass, Throwable cause)
      Construct a SmartServiceException.Builder using the class that is throwing the exception and the cause of the exception.
      Parameters:
      smartServiceClass - the class that is throwing the exception
      cause - the Throwable that was caught, causing the SmartServiceException to be thrown
    • Builder

      public Builder(Class smartServiceClass, String smartServiceBundleName, Throwable cause)
      Construct a SmartServiceException.Builder using the class that is throwing the exception, the bundle name, and the cause of the exception.
      Parameters:
      smartServiceClass - the class that is throwing the exception
      smartServiceBundleName - the bundle name used to locate the i18n properties file
      cause - the Throwable that was caught, causing the SmartServiceException to be thrown
  • Method Details

    • alertMessage

      public SmartServiceException.Builder alertMessage(String key, Object... args)
      Set the message that will be displayed in the error alert for both attended and unattended nodes.
      Parameters:
      key - the key to the error message in the bundle
      args - the set of parameters that are passed with the error message to include dynamic information in the message if the value of the error bundle contains templates.
      See Also:
    • addCauseToAlertMessageArgs

      public SmartServiceException.Builder addCauseToAlertMessageArgs()
      Specifies that the message of the cause exception should be added to the list of arguments passed to the alert message.
    • userMessage

      public SmartServiceException.Builder userMessage(String key, Object... args)
      Set the message that will be displayed in the user interface for attended nodes and in the error alert for both attended and unattended nodes if alertMessage is not set. The message is used when the smart service throws the exception.
      Parameters:
      key - the key to the error message in the bundle
      args - the set of parameters that are passed with the error message to include dynamic information in the message if the value of the error bundle contains templates.
    • addCauseToUserMessageArgs

      public SmartServiceException.Builder addCauseToUserMessageArgs()
      Specifies that the message of the cause exception should be added to the list of arguments passed to the user message.
    • errorCode

      public SmartServiceException.Builder errorCode(ErrorCode errorCode)
      Set the ErrorCode for the SmartServiceException that is to be built.
      Parameters:
      errorCode -
    • build

      public SmartServiceException build()
      After setting the userMessage, call build to create an instance of the SmartServiceException with the message set.
      Returns:
      the SmartServiceException with everything set