public class SendMailFunction extends AbstractContentWorkflowComponent implements com.opensymphony.workflow.FunctionProvider, Initializable, PluginAware
Modifier and Type | Field and Description |
---|---|
protected CurrentUserProvider |
_currentUserProvider
The current user provider.
|
protected I18nUtils |
_i18nUtils
I18nUtils
|
protected String |
_pluginName
The plugin name.
|
protected RightManager |
_rightManager
The rights manager.
|
protected SourceResolver |
_sourceResolver
The source resolver.
|
protected UserManager |
_userManager
The users manager.
|
protected WorkflowProvider |
_workflowProvider
The workflow.
|
protected static String |
BODY_KEY
The mail body key.
|
protected static String |
RIGHTS_KEY
The rights key.
|
static String |
SEND_MAIL
Provide "false" to prevent the function sending the mail.
|
protected static String |
SUBJECT_KEY
The mail subject key.
|
CONTENT_KEY
_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY
Constructor and Description |
---|
SendMailFunction() |
Modifier and Type | Method and Description |
---|---|
protected Set<UserIdentity> |
_getUsers(WorkflowAwareContent content,
Set<String> rights)
Get the user logins.
|
protected void |
_sendMails(String subject,
String body,
Set<UserIdentity> users,
String from)
Send the notification emails.
|
void |
execute(Map transientVars,
Map args,
com.opensymphony.module.propertyset.PropertySet ps) |
protected List<String> |
getBodyI18nParams(User user,
WorkflowAwareContent content)
Get the i18n parameters of mail body text
|
protected String |
getMailBody(String bodyI18nKey,
User user,
WorkflowAwareContent content,
Map transientVars)
Get the text body of mail
|
protected String |
getMailSubject(String subjectI18nKey,
User user,
WorkflowAwareContent content)
Get the subject of mail
|
protected List<String> |
getSubjectI18nParams(User user,
WorkflowAwareContent content)
Get the i18n parameters of mail subject
|
void |
initialize() |
void |
setPluginInfo(String pluginName,
String featureName,
String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level. |
getContent
addWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUser, service
public static final String SEND_MAIL
protected static final String RIGHTS_KEY
protected static final String SUBJECT_KEY
protected static final String BODY_KEY
protected CurrentUserProvider _currentUserProvider
protected RightManager _rightManager
protected UserManager _userManager
protected SourceResolver _sourceResolver
protected WorkflowProvider _workflowProvider
protected String _pluginName
protected I18nUtils _i18nUtils
public SendMailFunction()
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentpublic void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
execute
in interface com.opensymphony.workflow.FunctionProvider
com.opensymphony.workflow.WorkflowException
protected String getMailSubject(String subjectI18nKey, User user, WorkflowAwareContent content)
subjectI18nKey
- the i18n key to use for subjectuser
- the callercontent
- the contentprotected String getMailBody(String bodyI18nKey, User user, WorkflowAwareContent content, Map transientVars)
bodyI18nKey
- the i18n key to use for bodyuser
- the callercontent
- the contenttransientVars
- the transient variablesprotected void _sendMails(String subject, String body, Set<UserIdentity> users, String from)
subject
- the e-mail subject.body
- the e-mail body.users
- users to send the mail to.from
- the address sending the e-mail.protected List<String> getSubjectI18nParams(User user, WorkflowAwareContent content)
user
- the callercontent
- the contentprotected List<String> getBodyI18nParams(User user, WorkflowAwareContent content)
user
- the callercontent
- the contentprotected Set<UserIdentity> _getUsers(WorkflowAwareContent content, Set<String> rights) throws com.opensymphony.workflow.WorkflowException
content
- the content.rights
- the set of rights to check.com.opensymphony.workflow.WorkflowException
- If an error occurred