Class FormSendMailFunction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.forms.workflow.FormSendMailFunction
- All Implemented Interfaces:
com.opensymphony.workflow.FunctionProvider
,Component
,LogEnabled
,Serviceable
public class FormSendMailFunction
extends AbstractLogEnabled
implements Component, com.opensymphony.workflow.FunctionProvider, Serviceable
OS workflow function to send mail after an action is triggered.
The author of a form entry is also notified if the receipt is set
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user providerprotected FormDAO
The form DAOprotected I18nUtils
I18nUtilsprotected AmetysObjectResolver
The ametys object resolverprotected SiteManager
The site managerprotected SourceResolver
The source resolver.protected UserManager
The user managerprotected WorkflowFormMailExtensionPoint
The workflow form mail EPstatic final String
Body key argument of the emailstatic final String
Body xsl argument of the emailstatic final String
Comment argument of the emailstatic final String
Recipient argument of the emailstatic final String
Recipient role argument of the emailstatic final String
Send if comment argument of the emailstatic final String
Sender argument of the emailstatic final String
Sender role argument of the emailstatic final String
Subject key argument of the email -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Get the mail body First look at the configured xsl in mail-xsl Then look at the configured body i18n key in body-key Then take the default i18n keyprotected String
_getBodyFromI18nKey
(FormEntry formEntry, Map transientVars, Map args, String lang) Get the mail body from i18n key First look at the configured body i18n key in body-key Then take the default i18n key_getBodyI18nParams
(FormEntry formEntry) Get the i18n parameters of mail body textprotected String
Get a mail pipeline's content._getRecipients
(FormEntry formEntry, Map transientVars, Map args) Get the list of recipients to send the mail First look at the configured recipient role in recipient-role Then look at the configured recipient in recipient Then take the entry userprotected String
_getSender
(FormEntry formEntry, Map transientVars, Map args) Get the sender of the mail First look at the configured sender role in sender-role Then look at the configured sender in sender Then take the current user Then take the sender in admin configurationprotected String
_getSubject
(FormEntry formEntry, Map transientVars, Map args) Get the mail subject First look at the configured subject i18n key in subject-key Then take the default i18n key_getSubjectI18nParams
(FormEntry formEntry) Get the i18n parameters of mail subjectvoid
void
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ARG_SENDER
Sender argument of the email- See Also:
-
ARG_SENDER_ROLE
Sender role argument of the email- See Also:
-
ARG_RECIPIENT
Recipient argument of the email- See Also:
-
ARG_RECIPIENT_ROLE
Recipient role argument of the email- See Also:
-
ARG_SUBJECT_KEY
Subject key argument of the email- See Also:
-
ARG_BODY_KEY
Body key argument of the email- See Also:
-
ARG_BODY_XSL
Body xsl argument of the email- See Also:
-
ARG_COMMENT
Comment argument of the email- See Also:
-
ARG_SEND_IF_COMMENT
Send if comment argument of the email- See Also:
-
_currentUserProvider
The current user provider -
_userManager
The user manager -
_sourceResolver
The source resolver. -
_resolver
The ametys object resolver -
_formDAO
The form DAO -
_i18nUtils
I18nUtils -
_workflowFormMailEP
The workflow form mail EP -
_siteManager
The site manager
-
-
Constructor Details
-
FormSendMailFunction
public FormSendMailFunction()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
execute
public void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException - Specified by:
execute
in interfacecom.opensymphony.workflow.FunctionProvider
- Throws:
com.opensymphony.workflow.WorkflowException
-
_getSender
Get the sender of the mail First look at the configured sender role in sender-role Then look at the configured sender in sender Then take the current user Then take the sender in admin configuration- Parameters:
formEntry
- the form entrytransientVars
- the workflow transient varsargs
- the workflow args- Returns:
- the mail subject as string
-
_getRecipients
Get the list of recipients to send the mail First look at the configured recipient role in recipient-role Then look at the configured recipient in recipient Then take the entry user- Parameters:
formEntry
- the form entrytransientVars
- the workflow transient varsargs
- the workflow args- Returns:
- the mail subject as string
-
_getSubject
Get the mail subject First look at the configured subject i18n key in subject-key Then take the default i18n key- Parameters:
formEntry
- the form entrytransientVars
- the workflow transient varsargs
- the workflow args- Returns:
- the mail subject as string
-
_getBody
Get the mail body First look at the configured xsl in mail-xsl Then look at the configured body i18n key in body-key Then take the default i18n key- Parameters:
formEntry
- the form entrytransientVars
- the workflow transient varsargs
- the workflow args- Returns:
- the mail body as string
- Throws:
IOException
- if an error occurred
-
_getBodyFromI18nKey
Get the mail body from i18n key First look at the configured body i18n key in body-key Then take the default i18n key- Parameters:
formEntry
- the form entrytransientVars
- the workflow transient varsargs
- the workflow argslang
- the language- Returns:
- the mail body as string
-
_getSubjectI18nParams
Get the i18n parameters of mail subject- Parameters:
formEntry
- the form entry- Returns:
- the i18n parameters
-
_getBodyI18nParams
Get the i18n parameters of mail body text- Parameters:
formEntry
- the form entry- Returns:
- the i18n parameters
-
_getMail
protected String _getMail(String resource, FormEntry entry, String xslPath, String comment) throws IOException Get a mail pipeline's content.- Parameters:
resource
- the mail resource pipelineentry
- the user input.xslPath
- the xsl pathcomment
- the comment- Returns:
- the mail content.
- Throws:
IOException
- if an error occurs.
-