public class TranslationAlertFunction extends AbstractContentWorkflowComponent implements com.opensymphony.workflow.FunctionProvider, Initializable, PluginAware
| Modifier and Type | Field and Description |
|---|---|
protected String |
_baseUrl
The server base URL.
|
protected I18nUtils |
_i18nUtils
The i18n utils.
|
protected String |
_pluginName
The plugin name.
|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected RightManager |
_rightManager
The rights manager.
|
protected UserManager |
_userManager
The users manager.
|
static String |
I18N_KEY_BODY
The e-mail body i18n key.
|
static String |
I18N_KEY_SUBJECT
The e-mail subject i18n key.
|
_contentHelper, CONTENT_KEY_logger, _manager, CONTEXT_PARAMETERS_KEY, FAIL_CONDITIONS_KEY, RESULT_MAP_KEY, WORKFLOW_ERRORS_KEY, WORKFLOW_WARNS_KEY| Constructor and Description |
|---|
TranslationAlertFunction() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Map transientVars,
Map args,
com.opensymphony.module.propertyset.PropertySet ps) |
protected String |
getPageUrl(Page page)
Get the URL of the back-office, opening on the page tool.
|
protected Map<String,Page> |
getTranslations(Page page)
Get the translations of a given page.
|
protected HashSet<UserIdentity> |
getUsersToNotify(Page translatedPage)
Get the users to notify about the page translation.
|
void |
initialize() |
protected void |
sendAlert(Page page,
WebContent content,
Page translatedPage,
Set<UserIdentity> users)
Build and send an alert e-mail to inform of a translation to a list of users.
|
protected void |
sendAlerts(WebContent content)
Send the alerts to tell users the translated content was modified.
|
protected void |
sendMails(String subject,
String body,
Set<UserIdentity> users,
String from)
Send a translation alert e-mail to the specified users.
|
void |
service(ServiceManager serviceManager) |
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. |
getContentaddWorkflowError, addWorkflowWarning, enableLogging, getConditionFailures, getContextParameters, getResultsMap, getUserpublic static final String I18N_KEY_SUBJECT
public static final String I18N_KEY_BODY
protected UserManager _userManager
protected RightManager _rightManager
protected I18nUtils _i18nUtils
protected AmetysObjectResolver _resolver
protected String _pluginName
public TranslationAlertFunction()
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAwaresetPluginInfo in interface PluginAwarepluginName - Unique identifier for the plugin hosting the extensionfeatureName - Unique feature identifier (unique for a given pluginName)id - Unique identifier of this componentpublic void initialize() throws Exception
initialize in interface InitializableExceptionpublic void service(ServiceManager serviceManager) throws ServiceException
service in interface Serviceableservice in class AbstractContentWorkflowComponentServiceExceptionpublic void execute(Map transientVars, Map args, com.opensymphony.module.propertyset.PropertySet ps) throws com.opensymphony.workflow.WorkflowException
execute in interface com.opensymphony.workflow.FunctionProvidercom.opensymphony.workflow.WorkflowExceptionprotected void sendAlerts(WebContent content)
content - the modified content.protected void sendAlert(Page page, WebContent content, Page translatedPage, Set<UserIdentity> users)
page - the modified page.content - the content which was modified.translatedPage - the translated page.users - the users to send the e-mail to.protected void sendMails(String subject, String body, Set<UserIdentity> users, String from)
subject - the e-mail subject.body - the e-mail body.users - the users to send the e-mail to.from - the e-mail will be sent with this "from" header.protected HashSet<UserIdentity> getUsersToNotify(Page translatedPage)
translatedPage - the translated version of the page.protected Map<String,Page> getTranslations(Page page)
page - the page.protected String getPageUrl(Page page)
page - the page to open on.