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 String |
NAME
Action executor constants
|
static String |
PARAM_BCC |
static String |
PARAM_CC |
static String |
PARAM_FROM |
static String |
PARAM_FROM_PERSONAL_NAME |
static String |
PARAM_HTML |
static String |
PARAM_IGNORE_SEND_FAILURE |
static String |
PARAM_LOCALE |
static String |
PARAM_SEND_AFTER_COMMIT |
static String |
PARAM_SUBJECT |
static String |
PARAM_SUBJECT_PARAMS |
static String |
PARAM_TEMPLATE |
static String |
PARAM_TEMPLATE_MODEL |
static String |
PARAM_TEXT |
static String |
PARAM_TO |
static String |
PARAM_TO_MANY |
actionDefinition, applicableTypes, publicAction
adhocPropertiesAllowed, DISPLAY_LABEL, runtimeActionService
name
PARAM_RESULT
Constructor and Description |
---|
MailActionExecuter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addParameterDefinitions(List<ParameterDefinition> 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(String user) |
String |
getPersonEmail(String user) |
String |
getTestMessageTo() |
int |
getTestSentCount() |
void |
init()
Init method
|
boolean |
isFromEnabled() |
static boolean |
isHTML(String value) |
boolean |
isTestMode() |
protected void |
onFail() |
protected void |
onSend() |
boolean |
personExists(String user) |
org.springframework.mail.javamail.MimeMessageHelper |
prepareEmail(Action ruleAction,
org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef,
org.alfresco.util.Pair<String,Locale> recipient,
org.alfresco.util.Pair<InternetAddress,Locale> sender) |
int |
resetTestSentCount() |
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(String fromAddress) |
void |
setFromEnabled(boolean fromEnabled) |
void |
setHeaderEncoding(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(String testMessageSubject) |
void |
setTestMessageText(String testMessageText) |
void |
setTestMessageTo(String testMessageTo) |
void |
setTestMode(boolean testMode) |
void |
setTestModeRecipient(String testModeRecipient) |
void |
setValidateAddresses(boolean validateAddresses) |
createActionDefinition, execute, getActionDefinition, getIgnoreLock, getQueueName, getTrackStatus, isApplicableType, onLogException, setApplicableTypes, setBaseNodeService, setDictionaryService, setIgnoreLock, setLockService, setMlAwareNodeService, setPublicAction, setQueueName, setTrackStatus
checkMandatoryProperties, getAdhocPropertiesAllowed, getDescriptionKey, getLocalizedParameterDefinitions, getParamDisplayLabel, getParamDisplayLabel, getParameterDefintions, getTitleKey, setAdhocPropertiesAllowed, setLocales, setRuntimeActionService, toString
setBeanName
public static final String NAME
public static final String PARAM_LOCALE
public static final String PARAM_TO
public static final String PARAM_CC
public static final String PARAM_BCC
public static final String PARAM_TO_MANY
public static final String PARAM_SUBJECT
public static final String PARAM_SUBJECT_PARAMS
public static final String PARAM_TEXT
public static final String PARAM_HTML
public static final String PARAM_FROM
public static final String PARAM_FROM_PERSONAL_NAME
public static final String PARAM_TEMPLATE
public static final String PARAM_TEMPLATE_MODEL
public static final String PARAM_IGNORE_SEND_FAILURE
public static final 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(String headerEncoding)
headerEncoding
- The mail header encoding to set.public void setFromAddress(String fromAddress)
fromAddress
- The default mail address.public void setSysAdminParams(SysAdminParams sysAdminParams)
public void setImageResolver(TemplateImageResolver imageResolver)
public void setTestMessageTo(String testMessageTo)
public String getTestMessageTo()
public void setTestMessageSubject(String testMessageSubject)
public void setTestMessageText(String testMessageText)
public void setSendTestMessage(boolean sendTestMessage)
public boolean sendTestMessage()
org.alfresco.error.AlfrescoRuntimeException
public void setTestModeRecipient(String testModeRecipient)
public void setValidateAddresses(boolean validateAddresses)
public void init()
ActionExecuterAbstractBase
init
in class ActionExecuterAbstractBase
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
protected void executeImpl(Action ruleAction, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef)
executeImpl
in class ActionExecuterAbstractBase
ruleAction
- the actionactionedUponNodeRef
- the actioned upon nodeorg.alfresco.error.AlfrescoRuntimeException
public org.springframework.mail.javamail.MimeMessageHelper prepareEmail(Action ruleAction, org.alfresco.service.cmr.repository.NodeRef actionedUponNodeRef, org.alfresco.util.Pair<String,Locale> recipient, org.alfresco.util.Pair<InternetAddress,Locale> sender)
public boolean personExists(String user)
public org.alfresco.service.cmr.repository.NodeRef getPerson(String user)
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
addParameterDefinitions
in class ParameterizedItemAbstractBase
paramList
- the parameter definitions listpublic void setTestMode(boolean testMode)
setTestMode
in interface TestModeable
public boolean isTestMode()
isTestMode
in interface TestModeable
public MimeMessage retrieveLastTestMessage()
public int getTestSentCount()
public int resetTestSentCount()
public void clearLastTestMessage()
public void setFromEnabled(boolean fromEnabled)
public boolean isFromEnabled()
public static boolean isHTML(String value)
protected void onSend()
protected void onFail()
public int getNumberSuccessfulSends()
public int getNumberFailedSends()
Copyright © 2005–2017 Alfresco Software. All rights reserved.