public class MailActionExecuter extends ActionExecuterAbstractBase implements org.springframework.beans.factory.InitializingBean, TestModeable
mail actions as system.
However there is a limitation if you do so. Because the system user is not a normal user and specifically because
there is no corresponding cm:person node for system, it is not possible to use
any reference to that person in the associated email template. Various email templates use a 'person' object
in the FTL model to access things like first name, last name etc.
In the case of mail actions sent while running as system, none of these will be available.| Modifier and Type | Class and Description |
|---|---|
static class |
MailActionExecuter.URLHelper |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NAME
Action executor constants
|
static java.lang.String |
PARAM_FROM |
static java.lang.String |
PARAM_FROM_PERSONAL_NAME |
static java.lang.String |
PARAM_HTML |
static java.lang.String |
PARAM_IGNORE_SEND_FAILURE |
static java.lang.String |
PARAM_LOCALE |
static java.lang.String |
PARAM_SEND_AFTER_COMMIT |
static java.lang.String |
PARAM_SUBJECT |
static java.lang.String |
PARAM_SUBJECT_PARAMS |
static java.lang.String |
PARAM_TEMPLATE |
static java.lang.String |
PARAM_TEMPLATE_MODEL |
static java.lang.String |
PARAM_TEXT |
static java.lang.String |
PARAM_TO |
static java.lang.String |
PARAM_TO_MANY |
actionDefinition, applicableTypes, publicActionadhocPropertiesAllowed, DISPLAY_LABEL, runtimeActionServicenamePARAM_RESULT| Constructor and Description |
|---|
MailActionExecuter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addParameterDefinitions(java.util.List paramList)
Add the parameter definitions
|
void |
afterPropertiesSet()
Initialise bean
|
void |
clearLastTestMessage()
Used when test mode is enabled.
|
protected void |
executeImpl(Action ruleAction,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
Send an email message
|
int |
getNumberFailedSends() |
int |
getNumberSuccessfulSends() |
org.alfresco.service.cmr.repository.NodeRef |
getPerson(java.lang.String user) |
java.lang.String |
getPersonEmail(java.lang.String user) |
java.lang.String |
getTestMessageTo() |
void |
init()
Init method
|
boolean |
isFromEnabled() |
static boolean |
isHTML(java.lang.String value) |
boolean |
isTestMode() |
protected void |
onFail() |
protected void |
onSend() |
boolean |
personExists(java.lang.String user) |
org.springframework.mail.javamail.MimeMessageHelper |
prepareEmail(Action ruleAction,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
org.alfresco.util.Pair recipient,
org.alfresco.util.Pair sender) |
javax.mail.internet.MimeMessage |
retrieveLastTestMessage()
Returns the most recent message that wasn't sent
because TestMode had been enabled.
|
boolean |
sendTestMessage()
Send a test message
|
void |
setAuthenticationService(AuthenticationService authService) |
void |
setAuthorityService(AuthorityService authorityService) |
void |
setFromAddress(java.lang.String fromAddress) |
void |
setFromEnabled(boolean fromEnabled) |
void |
setHeaderEncoding(java.lang.String headerEncoding) |
void |
setImageResolver(TemplateImageResolver imageResolver) |
void |
setMailService(org.springframework.mail.javamail.JavaMailSender javaMailSender) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setPersonService(PersonService personService) |
void |
setPreferenceService(PreferenceService preferenceService) |
void |
setSendTestMessage(boolean sendTestMessage) |
void |
setServiceRegistry(ServiceRegistry serviceRegistry) |
void |
setSysAdminParams(SysAdminParams sysAdminParams) |
void |
setTemplateService(TemplateService templateService) |
void |
setTenantService(org.alfresco.repo.tenant.TenantService tenantService) |
void |
setTestMessageSubject(java.lang.String testMessageSubject) |
void |
setTestMessageText(java.lang.String testMessageText) |
void |
setTestMessageTo(java.lang.String testMessageTo) |
void |
setTestMode(boolean testMode) |
void |
setTestModeRecipient(java.lang.String testModeRecipient) |
void |
setValidateAddresses(boolean validateAddresses) |
createActionDefinition, execute, getActionDefinition, getIgnoreLock, getQueueName, getTrackStatus, isApplicableType, setApplicableTypes, setBaseNodeService, setDictionaryService, setIgnoreLock, setLockService, setMlAwareNodeService, setPublicAction, setQueueName, setTrackStatuscheckMandatoryProperties, getAdhocPropertiesAllowed, getDescriptionKey, getParamDisplayLabel, getParameterDefintions, getTitleKey, setAdhocPropertiesAllowed, setRuntimeActionService, toStringsetBeanNamepublic static final java.lang.String NAME
public static final java.lang.String PARAM_LOCALE
public static final java.lang.String PARAM_TO
public static final java.lang.String PARAM_TO_MANY
public static final java.lang.String PARAM_SUBJECT
public static final java.lang.String PARAM_SUBJECT_PARAMS
public static final java.lang.String PARAM_TEXT
public static final java.lang.String PARAM_HTML
public static final java.lang.String PARAM_FROM
public static final java.lang.String PARAM_FROM_PERSONAL_NAME
public static final java.lang.String PARAM_TEMPLATE
public static final java.lang.String PARAM_TEMPLATE_MODEL
public static final java.lang.String PARAM_IGNORE_SEND_FAILURE
public static final java.lang.String PARAM_SEND_AFTER_COMMIT
public void setMailService(org.springframework.mail.javamail.JavaMailSender javaMailSender)
javaMailSender - the java mail senderpublic void setTemplateService(TemplateService templateService)
templateService - the TemplateServicepublic void setPersonService(PersonService personService)
personService - the PersonServicepublic void setPreferenceService(PreferenceService preferenceService)
public void setAuthenticationService(AuthenticationService authService)
authService - the AuthenticationServicepublic void setServiceRegistry(ServiceRegistry serviceRegistry)
serviceRegistry - the ServiceRegistrypublic void setAuthorityService(AuthorityService authorityService)
authorityService - the AuthorityServicepublic void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
nodeService - the NodeService to set.public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
tenantService - the TenantService to set.public void setHeaderEncoding(java.lang.String headerEncoding)
headerEncoding - The mail header encoding to set.public void setFromAddress(java.lang.String fromAddress)
fromAddress - The default mail address.public void setSysAdminParams(SysAdminParams sysAdminParams)
public void setImageResolver(TemplateImageResolver imageResolver)
public void setTestMessageTo(java.lang.String testMessageTo)
public java.lang.String getTestMessageTo()
public void setTestMessageSubject(java.lang.String testMessageSubject)
public void setTestMessageText(java.lang.String testMessageText)
public void setSendTestMessage(boolean sendTestMessage)
public boolean sendTestMessage()
org.alfresco.error.AlfrescoRuntimeExceptionpublic void setTestModeRecipient(java.lang.String testModeRecipient)
public void setValidateAddresses(boolean validateAddresses)
public void init()
ActionExecuterAbstractBaseinit in class ActionExecuterAbstractBasepublic void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionprotected void executeImpl(Action ruleAction, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
executeImpl in class ActionExecuterAbstractBaseruleAction - the actionactionedUponNodeRef - the actioned upon nodeAlfrescoRuntimeExeptionpublic org.springframework.mail.javamail.MimeMessageHelper prepareEmail(Action ruleAction, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, org.alfresco.util.Pair recipient, org.alfresco.util.Pair sender)
public boolean personExists(java.lang.String user)
public org.alfresco.service.cmr.repository.NodeRef getPerson(java.lang.String user)
public java.lang.String getPersonEmail(java.lang.String user)
protected void addParameterDefinitions(java.util.List paramList)
addParameterDefinitions in class ParameterizedItemAbstractBaseparamList - the parameter definitions listpublic void setTestMode(boolean testMode)
setTestMode in interface TestModeablepublic boolean isTestMode()
isTestMode in interface TestModeablepublic javax.mail.internet.MimeMessage retrieveLastTestMessage()
public void clearLastTestMessage()
public void setFromEnabled(boolean fromEnabled)
public boolean isFromEnabled()
public static boolean isHTML(java.lang.String value)
protected void onSend()
protected void onFail()
public int getNumberSuccessfulSends()
public int getNumberFailedSends()
Copyright © 2005 - 2013 Alfresco Software, Inc. All Rights Reserved.