Class AsyncScriptHandler
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.ui.script.ScriptHandler
org.ametys.plugins.core.ui.script.AsyncScriptHandler
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Contextualizable
,Serviceable
Component able to execute scripts asynchronously, either from a schedulable or because the user asked to do so.
Script results are sent by email.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.core.ui.script.ScriptHandler
ScriptHandler.ResultProcessor
-
Field Summary
Fields inherited from class org.ametys.plugins.core.ui.script.ScriptHandler
_context, _currentUserProvider, _i18nUtils, _rightManager, _scriptBindingEP, RIGHT_EXECUTE_SCRIPTS, ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Initializes_mailSenderProvider
.protected ScriptHandler.ResultProcessor
Returns theScriptHandler.ResultProcessor
used to process script result.void
void
sendReportMail
(Map<String, Object> scriptResults, UserIdentity user, String mailRecipient, Locale locale, Logger logger) Send a mail report from the result of a scriptMethods inherited from class org.ametys.plugins.core.ui.script.ScriptHandler
_executeScript, buildExecArguments, contextualize, executeScript, executeScript, executeScript, getScriptBindingDescription, getWorkspaceName, processScriptResult, service
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
COMPONENT_ROLE
Avalon role.
-
-
Constructor Details
-
AsyncScriptHandler
public AsyncScriptHandler()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
_initializeMailSenderProvider
Initializes_mailSenderProvider
. The argument of the provider is the mail of the recipient (as string) -
getProcessor
Description copied from class:ScriptHandler
Returns theScriptHandler.ResultProcessor
used to process script result.- Overrides:
getProcessor
in classScriptHandler
- Returns:
- the
ScriptHandler.ResultProcessor
.
-
sendReportMail
public void sendReportMail(Map<String, Object> scriptResults, UserIdentity user, String mailRecipient, Locale locale, Logger logger) throws jakarta.mail.MessagingException, IOExceptionSend a mail report from the result of a script- Parameters:
scriptResults
- The result of the scriptuser
- The usermailRecipient
- The recipient of the result maillocale
- The user localelogger
- The logger- Throws:
jakarta.mail.MessagingException
- If an error occurred while preparing or sending emailIOException
- If an error occurred with an attachment.
-