Package com.avoka.fc.core.service.email
Class GroovyEmailService
java.lang.Object
com.avoka.fc.core.service.BaseService
com.avoka.fc.core.service.CayenneService
com.avoka.fc.core.service.email.AbstractEmailService
com.avoka.fc.core.service.email.GroovyEmailService
- All Implemented Interfaces:
IEmailService
,IGroovyDebugLogService
,IServiceDefinitionAware
,IUnitTestableService
public class GroovyEmailService
extends AbstractEmailService
implements IServiceDefinitionAware, IUnitTestableService, IGroovyDebugLogService
Provides a Groovy Email service.
- Since:
- 4.3.2
-
Nested Class Summary
Nested classes/interfaces inherited from class com.avoka.fc.core.service.email.AbstractEmailService
AbstractEmailService.EmailFormat, AbstractEmailService.TempForm, AbstractEmailService.TempSubmission, AbstractEmailService.TempSubmissionExtractData, AbstractEmailService.TempUser
-
Field Summary
Fields inherited from class com.avoka.fc.core.service.email.AbstractEmailService
EMAIL_INFO_EVENT_LOG_PATTEN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ApplicationException
createExceptionAndLog
(Date startTime, com.jezhumble.javasysmon.CpuTimes startCpuTimes, Long startFreeMemory, Throwable cause, String context, String userMsg, String solution, Submission submission, Form form, Client client) Create application exception and optionally log ErrorLog and GroovyServiceLog records if Groovy Logging enabled.protected Object
executeGroovyScript
(Map<String, Object> parameters, Client client) Execute the service Groovy Script using the given parameters and security context client.protected Throwable
Return the root cause of the exceptionReturn the GroovyScript execution timeout in milliseconds.Return true if GroovyLogger DEBUG level message recording is enabled.Return the GroovyServiceLog record created after executing the script.Return the service definitionprotected String
Deprecated.this no longer uniquely identifies the service - use getNameAndVersion() where possibleprotected String
protected Integer
Return the service Unit Test Script logger output.boolean
Return true if the Exception DEBUG level message recording is enabled.boolean
Return true if the Groovy Service logging is enabled.boolean
Return true if the Groovy runtime should perform static type checking.Run the service's Unit Test Script if defined for the service, returning null if succeeded or an error if it failed.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.void
setExceptionDebugLoggingEnabled
(Boolean debugEnabled) Specify whether the Exception DEBUG level message recording is enabled.void
setExecutionTimeout
(Integer timeout) Return the GroovyScript execution timeout in milliseconds.void
setGroovyDebugLogging
(Boolean debugEnabled) Set whether GroovyLogger DEBUG level message recording is enabled.void
setGroovyLoggingEnabled
(Boolean loggingEnabled) Specify whether the Groovy Service logging is enabled.void
setGroovyScript
(String script) void
setGroovyTypeChecked
(boolean typeChecked) Specify whether the Groovy runtime should perform static type checking.void
setServiceDefinition
(ServiceDefinition serviceDefinition) Set the service definition.Methods inherited from class com.avoka.fc.core.service.email.AbstractEmailService
getTemplatedEmailMessageForPortal, getTemplatedEmailMessageForSubmission, getTemplatedEmailMessageForSubmission, queueAccountStatusNotification, queueEmail, queueEmail, queueEmail, queueEmail, queueEmail, queueFormReceiptEmail, queueFormReceiptEmail, queueFormReceiptEmail, queueNewAccountNotification, queueOrSendFormConfirmationReceiptMessage, queuePromotionNotificationMessage, queueSavedFormEmail, queueSavedFormEmail, queueSavedFormEmail, queueShareFormEmail, queueSubmissionUpdateNotification, queueTemplatedMessageForPortal, renderDeploymentPropertyTemplate, sendDuplicatePaymentAlertEmailToClientAdmin, sendEmailVerification, sendEmailVerification, sendFormConfirmationMessage, sendFormReceiptMessage, sendFraudAlertEmailToClientAdmin, sendLostPasswordMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessageWithSubmissionAttachments, sendSavedFormEmail, sendSavedFormEmail, sendTaskNotification, sendTemplatedMessageForPortal, sendWelcomeUserMessage, sendWelcomeUserMessage
Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.avoka.fc.core.service.IGroovyDebugLogService
isGroovyDebugLogging
-
Constructor Details
-
GroovyEmailService
public GroovyEmailService()
-
-
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 interfaceIEmailService
- Parameters:
subject
- email subjectmessage
- email message bodyfromAddress
- the from addressreplyToAddress
- the reply-to addresstoAddress
- email to addressccAddress
- email address to ccbccAddress
- email address to bccattachmentMap
- attachments mapsubmission
- the submission the email relates to (optional)- See Also:
-
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 interfaceIUnitTestableService
- Returns:
- an Exception if the test case failed, or null if the test case succeeded or no 'Unit Test Script' defined.
- See Also:
-
getTestLogOutput
Return the service Unit Test Script logger output.- Specified by:
getTestLogOutput
in interfaceIUnitTestableService
- Returns:
- the service Unit Test Script logger output
- Since:
- 17.10.0
- See Also:
-
getGroovyServiceLog
Return the GroovyServiceLog record created after executing the script.- Returns:
- the GroovyServiceLog record created after executing the script.
-
getGroovyDebugLogging
Return true if GroovyLogger DEBUG level message recording is enabled.- Specified by:
getGroovyDebugLogging
in interfaceIGroovyDebugLogService
- Returns:
- true if GroovyLogger DEBUG level message recording is enabled.
- Since:
- 20.11.7
-
setGroovyDebugLogging
Set whether GroovyLogger DEBUG level message recording is enabled.- Specified by:
setGroovyDebugLogging
in interfaceIGroovyDebugLogService
- Parameters:
debugEnabled
- the groovyDebugLoggingEnabled to set- Since:
- 4.3.4
-
isGroovyLoggingEnabled
public boolean isGroovyLoggingEnabled()Return true if the Groovy Service logging is enabled.- Returns:
- true if the Groovy Service logging is enabled.
-
setGroovyLoggingEnabled
Specify whether the Groovy Service logging is enabled.- Parameters:
loggingEnabled
- specify whether the Groovy Service logging is enabled
-
setExceptionDebugLoggingEnabled
Specify whether the Exception DEBUG level message recording is enabled.- Parameters:
debugEnabled
- specify the Exception DEBUG level message recording is enabled- Since:
- 19.5.3
-
isExceptionDebugLoggingEnabled
public boolean isExceptionDebugLoggingEnabled()Return true if the Exception DEBUG level message recording is enabled.- Returns:
- true if the Exception DEBUG level message recording is enabled.
- Since:
- 19.5.3
-
getGroovyScript
- Returns:
- the Groovy Script content to execute
-
setGroovyScript
- Parameters:
script
- the Groovy Script content to execute
-
isGroovyTypeChecked
public boolean isGroovyTypeChecked()Return true if the Groovy runtime should perform static type checking.- Returns:
- true if the Groovy runtime should perform static type checking
-
setGroovyTypeChecked
public void setGroovyTypeChecked(boolean typeChecked) Specify whether the Groovy runtime should perform static type checking.- Parameters:
typeChecked
- specify whether the Groovy runtime should perform static type checking
-
getExecutionTimeout
Return the GroovyScript execution timeout in milliseconds.- Returns:
- the GroovyScript execution timeout in milliseconds
-
setExecutionTimeout
Return the GroovyScript execution timeout in milliseconds.- Parameters:
timeout
- the GroovyScript execution timeout in milliseconds
-
getServiceDefinition
Return the service definition- Specified by:
getServiceDefinition
in interfaceIServiceDefinitionAware
- Overrides:
getServiceDefinition
in classAbstractEmailService
- Returns:
- the service definition.
- See Also:
-
setServiceDefinition
Set the service definition.- Specified by:
setServiceDefinition
in interfaceIServiceDefinitionAware
- Overrides:
setServiceDefinition
in classAbstractEmailService
- Parameters:
serviceDefinition
- the service definition to set- See Also:
-
executeGroovyScript
Execute the service Groovy Script using the given parameters and security context client.- Parameters:
parameters
- the script parameters (required)client
- the calling client (optional)- Returns:
- a new GroovyScript runtime for the given client
-
createExceptionAndLog
protected ApplicationException createExceptionAndLog(Date startTime, com.jezhumble.javasysmon.CpuTimes startCpuTimes, Long startFreeMemory, Throwable cause, String context, String userMsg, String solution, Submission submission, Form form, Client client) Create application exception and optionally log ErrorLog and GroovyServiceLog records if Groovy Logging enabled.- Parameters:
startTime
- the time the service was invoked prior to the errorstartCpuTimes
- the CPU times when the service was invoked (required)startFreeMemory
- the free memory in bytes when the service was invoked (required)cause
- the root cause of the errorcontext
- the error context informationuserMsg
- the user messagesolution
- the solutionsubmission
- the submission objectform
- the formclient
- the client- Returns:
- a new application exception
-
getServiceName
Deprecated.this no longer uniquely identifies the service - use getNameAndVersion() where possible- Returns:
- the service definition service name
-
getServiceNameAndVersion
- Returns:
- the service definition name and version number
-
getServiceTimeout
- Returns:
- the service timeout
-
getCause
Return the root cause of the exception- Parameters:
e
- the error- Returns:
- the root cause of the exception
- Since:
- 4.3.1
-