Package org.ametys.cms.alerts
Class AlertSchedulable
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
org.ametys.cms.alerts.AlertSchedulable
- All Implemented Interfaces:
Schedulable,LogEnabled,PluginAware,Initializable,Component,Configurable,Contextualizable,Serviceable
- Direct Known Subclasses:
AlertSchedulable
Alerts engine: sends alerts mail.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classBinary date expression: test on two metadatas.Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final ExpressionContextThe context used for validation alerts expressionsprotected StringThe "waiting for validation" e-mail body i18n key.The "waiting for validation" e-mail will be sent to users that have at least one of this rights.protected StringThe "waiting for validation" e-mail subject i18n key.protected StringThe server base URL.protected ContextThe cocoon environment context.protected I18nUtilsThe i18n utils.protected booleanIs the engine initialized ?protected StringThe instant alert e-mail body i18n key.The instant alert e-mail will be sent to users that have this at least one of this rights.protected StringThe instant alert e-mail subject i18n key.protected StringThe content of "from" field in emails.protected ServiceManagerThe service manager.protected StringThe reminder e-mail body i18n key.The reminder e-mail will be sent to users that have this at least one of this rights.protected StringThe reminder e-mail subject i18n key.protected AmetysObjectResolverThe ametys object resolver.protected RightManagerThe rights manager.protected StringThe scheduled archiving reminder e-mail body i18n key.The scheduled archiving reminder e-mail will be sent to users that have this at least one of this rights.protected StringThe scheduled archiving reminder e-mail subject i18n key.protected StringThe "unmodified content" e-mail body i18n key.The "unmodified content" e-mail will be sent to users that have at least one of this rights.protected int[]Only contents in this steps will be taken into account for the "unmodified content" alert.protected StringThe "unmodified content" e-mail subject i18n key.static final StringThe job context param to specify the target contents when using instantModestatic final StringThe job context param to set to true when using instantModestatic final StringThe job context param to set the message when using instantModestatic final StringThe schedulable idFields inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
_acceptConcurrentExecution, _context, _description, _iconGlyph, _iconLarge, _iconMedium, _iconSmall, _id, _label, _parameters, _pluginName, _private, _schedulableParameterTypeExtensionPoint, _smanager, _startTime, _userManager, PROGRESSION_TRACKER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_getAdditionalParams(Content content) Get the additional i18n parameters for content_getAwaitingValidationParams(Content content) Get the mail parameters.protected String_getContentUrl(Content content) Get the URL to the given content tool._getInstantAlertParams(Content content) Get the mail parameters for instant alert._getReminderParams(Content content) Get the mail parameters._getRightsFromConf(Configuration configuration) Get a set of rights from a configuration.Get the mail parameters._getUnmodifiedContentParams(Content content) Get the mail parameters.protected void_removeTimeParts(Calendar calendar) Remove the time parts from a calendar, leaving only date parts.protected voidSend the "awaiting validation" alerts.protected void_sendAwaitingValidationEmail(Content content) Send a "waiting for validation" e-mail alert to all the users who have the right to validate.protected void_sendInstantAlertEmail(Content content, String message) Send a instant e-mail alert to all the users who have the right to edit the content.protected void_sendInstantAlerts(List<String> contentIds, String message) Send instant alerts on contentsprotected void_sendMails(String subject, String body, Set<UserIdentity> users, String from) Send the alert emails.protected void_sendReminderEmail(Content content) Send a reminder e-mail to all the users who have the right to edit.protected voidSend the content reminders.protected voidSend a "scheduled archiving reminder" e-mail to all the users who have the right to archive.protected voidSend the scheduled archiving reminders on contents.protected voidSend the unmodified content alerts.protected void_sendUnmodifiedContentEmail(Content content) Send a "unmodified content" e-mail alert to all the users who have the right to edit.protected void_setRequestAttributes(Content content) Set the necessary request attributesvoidconfigure(Configuration configuration) Configure the engine (called by the scheduler).voidexecute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) Send all the alerts.protected StringgetI18nKeyBody(String bodyI18nKey, Content content) Get the transform i18n body key for specific contentvoidprotected booleanisInstantMode(JobDataMap jobDataMap) Check if the scheduler was triggered to send an instant alertvoidservice(ServiceManager manager) Methods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, contextualize, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, getProgressionTracker, isPrivate, setPluginInfoMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
SCHEDULABLE_ID
The schedulable id -
JOBDATAMAP_INSTANT_MODE_KEY
The job context param to set to true when using instantMode- See Also:
-
JOBDATAMAP_CONTENT_IDS_KEY
The job context param to specify the target contents when using instantMode- See Also:
-
JOBDATAMAP_MESSAGE_KEY
The job context param to set the message when using instantMode- See Also:
-
__VALIDATION_ALERT_EXPR_CONTEXT
The context used for validation alerts expressions -
_manager
The service manager. -
_baseUrl
The server base URL. -
_initialized
Is the engine initialized ? -
_environmentContext
The cocoon environment context. -
_resolver
The ametys object resolver. -
_rightManager
The rights manager. -
_i18nUtils
The i18n utils. -
_mailFrom
The content of "from" field in emails. -
_awaitingValidationRights
The "waiting for validation" e-mail will be sent to users that have at least one of this rights. -
_awaitingValidationSubject
The "waiting for validation" e-mail subject i18n key. -
_awaitingValidationBody
The "waiting for validation" e-mail body i18n key. -
_unmodifiedContentStepIds
Only contents in this steps will be taken into account for the "unmodified content" alert. -
_unmodifiedContentRights
The "unmodified content" e-mail will be sent to users that have at least one of this rights. -
_unmodifiedContentSubject
The "unmodified content" e-mail subject i18n key. -
_unmodifiedContentBody
The "unmodified content" e-mail body i18n key. -
_reminderRights
The reminder e-mail will be sent to users that have this at least one of this rights. -
_reminderSubject
The reminder e-mail subject i18n key. -
_reminderBody
The reminder e-mail body i18n key. -
_scheduledArchivingReminderRights
The scheduled archiving reminder e-mail will be sent to users that have this at least one of this rights. -
_scheduledArchivingReminderSubject
The scheduled archiving reminder e-mail subject i18n key. -
_scheduledArchivingReminderBody
The scheduled archiving reminder e-mail body i18n key. -
_instantAlertRights
The instant alert e-mail will be sent to users that have this at least one of this rights. -
_instantAlertSubject
The instant alert e-mail subject i18n key. -
_instantAlertBody
The instant alert e-mail body i18n key.
-
-
Constructor Details
-
AlertSchedulable
public AlertSchedulable()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractStaticSchedulable- Throws:
ServiceException
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
configure
Configure the engine (called by the scheduler).- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractStaticSchedulable- Parameters:
configuration- the component configuration.- Throws:
ConfigurationException- if the configuration is not valid
-
_setRequestAttributes
Set the necessary request attributes- Parameters:
content- The content
-
execute
public void execute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) throws Exception Send all the alerts. Can be overridden to add alerts.- Specified by:
executein interfaceSchedulable- Parameters:
context- the contextprogressionTracker- The progression tracker- Throws:
AmetysRepositoryException- if an error occurs.Exception- if an error occurred
-
isInstantMode
Check if the scheduler was triggered to send an instant alert- Parameters:
jobDataMap- the job data map- Returns:
- true if the scheduler was triggered to send an instant alert
-
_sendInstantAlerts
protected void _sendInstantAlerts(List<String> contentIds, String message) throws AmetysRepositoryException Send instant alerts on contents- Parameters:
contentIds- The contents to alert onmessage- The custom message to add to the mail- Throws:
AmetysRepositoryException- if an error occurred
-
_sendInstantAlertEmail
protected void _sendInstantAlertEmail(Content content, String message) throws AmetysRepositoryException Send a instant e-mail alert to all the users who have the right to edit the content.- Parameters:
content- the content about which to send the alert.message- the message- Throws:
AmetysRepositoryException- if an error occurred
-
_sendAwaitingValidationAlerts
Send the "awaiting validation" alerts.- Throws:
AmetysRepositoryException- if an error occurs.
-
_sendUnmodifiedAlerts
Send the unmodified content alerts.- Throws:
AmetysRepositoryException- if an error occurs.
-
_sendReminders
Send the content reminders.- Throws:
AmetysRepositoryException- if an error occurs.
-
_sendScheduledArchivingReminders
Send the scheduled archiving reminders on contents.- Throws:
AmetysRepositoryException- if an error occurs.
-
_sendAwaitingValidationEmail
Send a "waiting for validation" e-mail alert to all the users who have the right to validate.- Parameters:
content- the content about which to send the alert.- Throws:
AmetysRepositoryException- if an error occured on the repository
-
_sendUnmodifiedContentEmail
Send a "unmodified content" e-mail alert to all the users who have the right to edit.- Parameters:
content- the content about which to send the alert.- Throws:
AmetysRepositoryException- if an error occured on the repository
-
_sendReminderEmail
Send a reminder e-mail to all the users who have the right to edit.- Parameters:
content- the content about which to send the reminder.- Throws:
AmetysRepositoryException- if an error occured on the repository
-
_sendScheduledArchivingReminderEmail
protected void _sendScheduledArchivingReminderEmail(ModifiableContent content) throws AmetysRepositoryException Send a "scheduled archiving reminder" e-mail to all the users who have the right to archive.- Parameters:
content- the content about which to send the alert.- Throws:
AmetysRepositoryException- if an error occured on the repository
-
getI18nKeyBody
Get the transform i18n body key for specific content- Parameters:
bodyI18nKey- the original body keycontent- the content- Returns:
- the transform i18n body key
-
_getInstantAlertParams
Get the mail parameters for instant alert.- Parameters:
content- the content.- Returns:
- the parameters.
-
_getAdditionalParams
Get the additional i18n parameters for content- Parameters:
content- The content- Returns:
- The additional i18n parameters
-
_getAwaitingValidationParams
Get the mail parameters.- Parameters:
content- the content.- Returns:
- the parameters.
-
_getUnmodifiedContentParams
Get the mail parameters.- Parameters:
content- the content.- Returns:
- the parameters.
-
_getReminderParams
Get the mail parameters.- Parameters:
content- the content.- Returns:
- the parameters.
-
_getScheduledArchivingReminderParams
Get the mail parameters.- Parameters:
content- the content.- Returns:
- the parameters.
-
_sendMails
Send the alert emails.- Parameters:
subject- the e-mail subject.body- the e-mail body.users- users to send the mail to.from- the address sending the e-mail.
-
_getContentUrl
Get the URL to the given content tool.- Parameters:
content- the content.- Returns:
- the content URL.
-
_removeTimeParts
Remove the time parts from a calendar, leaving only date parts.- Parameters:
calendar- the calendar.
-
_getRightsFromConf
Get a set of rights from a configuration.- Parameters:
configuration- the configuration.- Returns:
- the set of rights.
- Throws:
ConfigurationException- if the configuration is not valid.
-