Class FluentEmailService

All Implemented Interfaces:
IFluentService, IEmailService, IServiceDefinitionAware, IUnitTestableService

public class FluentEmailService extends AbstractEmailService implements IFluentService
Provides a Fluent API Groovy Email service.
Since:
5.0.0
  • Constructor Details

    • FluentEmailService

      public FluentEmailService()
  • Method Details

    • sendEmailMessage

      public void sendEmailMessage(String subject, String message, String fromAddress, String replyToAddress, String toAddress, String ccAddress, String bccAddress, Map<String,byte[]> attachmentMap, Submission submission)
      Send an email message.
      Specified by:
      sendEmailMessage in interface IEmailService
      Parameters:
      subject - email subject
      message - email message body
      fromAddress - the from address
      replyToAddress - the reply-to address
      toAddress - email to address
      ccAddress - email address to cc
      bccAddress - email address to bcc
      attachmentMap - attachments map
      submission - the submission the email relates to (optional)
      See Also:
    • invoke

      public Object invoke(Map<String,Object> parameters)
      Invoke the Fluent Service using the given parameters.
      Specified by:
      invoke in interface IFluentService
      Parameters:
      parameters - the service script parameters (required)
      Returns:
      a new invocation result
      See Also:
    • getErrorType

      public String getErrorType()
      Specified by:
      getErrorType in interface IFluentService
      Returns:
      the service error type to be used to classify the error logging records
      See Also:
    • runUnitTest

      public Throwable runUnitTest()
      Run the service's Unit Test Script if defined for the service, returning null if succeeded or an error if it failed. If there is no 'Unit Test Script' defined, this method will return null.
      Specified by:
      runUnitTest in interface IUnitTestableService
      Returns:
      an Exception if the test case failed, or null if the test case succeeded or no 'Unit Test Script' defined.
      See Also:
    • getTestLogOutput

      public String getTestLogOutput()
      Return the service Unit Test Script logger output.
      Specified by:
      getTestLogOutput in interface IUnitTestableService
      Returns:
      the service Unit Test Script logger output
      Since:
      17.10.0
      See Also:
    • getGroovyServiceLog

      public GroovyServiceLog getGroovyServiceLog()
      Return the GroovyServiceLog record created after executing the script.
      Returns:
      the GroovyServiceLog record created after executing the script.
    • isGroovyDebugLogging

      public Boolean isGroovyDebugLogging()
      Return true if GroovyLogger DEBUG level message recording is enabled.
      Returns:
      true if GroovyLogger DEBUG level message recording is enabled.
    • setGroovyDebugLogging

      public void setGroovyDebugLogging(Boolean debugEnabled)
      Set whether GroovyLogger DEBUG level message recording is enabled.
      Parameters:
      debugEnabled - the groovyDebugLoggingEnabled to set
    • isGroovyLoggingEnabled

      public boolean isGroovyLoggingEnabled()
      Return true if the Groovy Service logging is enabled.
      Returns:
      true if the Groovy Service logging is enabled.
    • setGroovyLoggingEnabled

      public void setGroovyLoggingEnabled(Boolean loggingEnabled)
      Specify whether the Groovy Service logging is enabled.
      Parameters:
      loggingEnabled - specify whether the Groovy Service logging is enabled
    • getGroovyScript

      public String getGroovyScript()
      Returns:
      the Groovy Script content to execute
    • setGroovyScript

      public void setGroovyScript(String script)
      Parameters:
      script - the Groovy Script content to execute
    • getExecutionTimeout

      public Integer getExecutionTimeout()
      Return the GroovyScript execution timeout in milliseconds.
      Returns:
      the GroovyScript execution timeout in milliseconds
    • setExecutionTimeout

      public void setExecutionTimeout(Integer timeout)
      Return the GroovyScript execution timeout in milliseconds.
      Parameters:
      timeout - the GroovyScript execution timeout in milliseconds
    • getServiceDefinition

      public ServiceDefinition getServiceDefinition()
      Return the service definition
      Specified by:
      getServiceDefinition in interface IServiceDefinitionAware
      Overrides:
      getServiceDefinition in class AbstractEmailService
      Returns:
      the service definition.
    • setServiceDefinition

      public void setServiceDefinition(ServiceDefinition serviceDefinition)
      Set the service definition.
      Specified by:
      setServiceDefinition in interface IServiceDefinitionAware
      Overrides:
      setServiceDefinition in class AbstractEmailService
      Parameters:
      serviceDefinition - the service definition to set
    • setLogger

      public void setLogger(Logger logger)
      Set the service logger.
      Specified by:
      setLogger in interface IFluentService
      Parameters:
      logger - the service logger
      Since:
      17.10.0
      See Also: