public class AlertEngine extends Object implements Runnable
| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
AlertEngine.BinaryExpression
Binary date expression: test on two metadatas. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
protected AmetysObjectResolver | 
_ametysResolver
The ametys object resolver. 
 | 
protected String | 
_awaitingValidationBody
The "waiting for validation" e-mail body i18n key. 
 | 
protected Set<String> | 
_awaitingValidationRights
The "waiting for validation" e-mail will be sent to users that have at least one of this rights. 
 | 
protected String | 
_awaitingValidationSubject
The "waiting for validation" e-mail subject i18n key. 
 | 
protected String | 
_baseUrl
The server base URL. 
 | 
protected Context | 
_context
The avalon context. 
 | 
protected Context | 
_environmentContext
The cocoon environment context. 
 | 
protected I18nUtils | 
_i18nUtils
The i18n utils. 
 | 
protected boolean | 
_initialized
Is the engine initialized ? 
 | 
protected String | 
_instantAlertBody
The instant alert e-mail body i18n key. 
 | 
private List<String> | 
_instantAlertContentIds
The list of contents' id (for instant alerts only) 
 | 
private String | 
_instantAlertMessage
The email message (for instant alerts only) 
 | 
protected Set<String> | 
_instantAlertRights
The instant alert e-mail will be sent to users that have this at least one of this rights. 
 | 
protected String | 
_instantAlertSubject
The instant alert e-mail subject i18n key. 
 | 
protected boolean | 
_instantMode
True if the engine was been run in instant mode (for instant alerts only) 
 | 
protected static Logger | 
_LOGGER
The logger. 
 | 
protected String | 
_mailFrom
The content of "from" field in emails. 
 | 
protected ServiceManager | 
_manager
The service manager. 
 | 
protected String | 
_reminderBody
The reminder e-mail body i18n key. 
 | 
protected Set<String> | 
_reminderRights
The reminder e-mail will be sent to users that have this at least one of this rights. 
 | 
protected String | 
_reminderSubject
The reminder e-mail subject i18n key. 
 | 
protected RightManager | 
_rightManager
The rights manager. 
 | 
protected String | 
_scheduledArchivingReminderBody
The scheduled archiving reminder e-mail body i18n key. 
 | 
protected Set<String> | 
_scheduledArchivingReminderRights
The scheduled archiving reminder e-mail will be sent to users that have this at least one of this rights. 
 | 
protected String | 
_scheduledArchivingReminderSubject
The scheduled archiving reminder e-mail subject i18n key. 
 | 
protected String | 
_unmodifiedContentBody
The "unmodified content" e-mail body i18n key. 
 | 
protected Set<String> | 
_unmodifiedContentRights
The "unmodified content" e-mail will be sent to users that have at least one of this rights. 
 | 
protected int[] | 
_unmodifiedContentStepIds
Only contents in this steps will be taken into account for the "unmodified content" alert. 
 | 
protected String | 
_unmodifiedContentSubject
The "unmodified content" e-mail subject i18n key. 
 | 
protected UserManager | 
_userManager
The users manager. 
 | 
| Constructor and Description | 
|---|
AlertEngine()
Default constructor 
 | 
AlertEngine(List<String> contentIds,
           String message)
Constructor used to send instant alerts 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
_checkInitialization()
Check the initialization and throw an exception if not initialized. 
 | 
protected void | 
_dispose()
Dispose of the resources and looked-up components. 
 | 
protected List<String> | 
_getAdditionalParams(Content content)
Get the additional i18n parameters for content 
 | 
protected List<String> | 
_getAwaitingValidationParams(Content content)
Get the mail parameters. 
 | 
protected String | 
_getContentUrl(Content content)
Get the URL to the given content tool. 
 | 
protected List<String> | 
_getInstantAlertParams(Content content,
                      String message)
Get the mail parameters for instant alert. 
 | 
protected List<String> | 
_getReminderParams(Content content)
Get the mail parameters. 
 | 
protected Set<String> | 
_getRightsFromConf(Configuration configuration)
Get a set of rights from a configuration. 
 | 
protected List<String> | 
_getScheduledArchivingReminderParams(ModifiableContent content)
Get the mail parameters. 
 | 
protected List<String> | 
_getUnmodifiedContentParams(Content content)
Get the mail parameters. 
 | 
protected void | 
_removeTimeParts(Calendar calendar)
Remove the time parts from a calendar, leaving only date parts. 
 | 
protected void | 
_sendAlerts()
Send all the alerts. 
 | 
protected void | 
_sendAwaitingValidationAlerts()
Send 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()
Send instant alerts on contents 
 | 
protected 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 void | 
_sendReminders()
Send the content reminders. 
 | 
protected void | 
_sendScheduledArchivingReminderEmail(ModifiableContent content)
Send a "scheduled archiving reminder" e-mail to all the users who have the right to archive. 
 | 
protected void | 
_sendScheduledArchivingReminders()
Send the scheduled archiving reminders on contents. 
 | 
protected void | 
_sendUnmodifiedAlerts()
Send 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 attributes 
 | 
void | 
configure(Configuration configuration)
Configure the engine (called by the scheduler). 
 | 
protected String | 
getI18nKeyBody(String bodyI18nKey,
              Content content)
Get the transform i18n body key for specific content 
 | 
void | 
initialize(ServiceManager manager,
          Context context)
Initialize the alert engine. 
 | 
void | 
run()  | 
protected ServiceManager _manager
protected boolean _initialized
protected Context _environmentContext
protected AmetysObjectResolver _ametysResolver
protected RightManager _rightManager
protected UserManager _userManager
protected I18nUtils _i18nUtils
protected Set<String> _awaitingValidationRights
protected String _awaitingValidationSubject
protected String _awaitingValidationBody
protected int[] _unmodifiedContentStepIds
protected Set<String> _unmodifiedContentRights
protected String _unmodifiedContentSubject
protected String _unmodifiedContentBody
protected Set<String> _reminderRights
protected String _reminderSubject
protected String _reminderBody
protected Set<String> _scheduledArchivingReminderRights
protected String _scheduledArchivingReminderSubject
protected String _scheduledArchivingReminderBody
protected Set<String> _instantAlertRights
protected String _instantAlertSubject
protected String _instantAlertBody
protected boolean _instantMode
private List<String> _instantAlertContentIds
private String _instantAlertMessage
public AlertEngine()
public AlertEngine(List<String> contentIds, String message)
contentIds - The content's idmessage - the messagepublic void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException
manager - the avalon service manager.context - the avalon context.ContextException - if the CONTEXT_ENVIRONMENT_CONTEXT cannot be foundServiceException - if some components cannot be resolvedpublic void configure(Configuration configuration) throws ConfigurationException
configuration - the component configuration.ConfigurationException - if the configuration is not validprotected void _checkInitialization()
protected void _setRequestAttributes(Content content)
content - The contentprotected void _dispose()
protected void _sendAlerts() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.protected void _sendInstantAlerts() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurredprotected void _sendInstantAlertEmail(Content content, String message) throws AmetysRepositoryException
content - the content about which to send the alert.message - the messageAmetysRepositoryException - if an error occurredprotected void _sendAwaitingValidationAlerts() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.protected void _sendUnmodifiedAlerts() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.protected void _sendReminders() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.protected void _sendScheduledArchivingReminders() throws AmetysRepositoryException
AmetysRepositoryException - if an error occurs.protected void _sendAwaitingValidationEmail(Content content) throws AmetysRepositoryException
content - the content about which to send the alert.AmetysRepositoryException - if an error occured on the repositoryprotected void _sendUnmodifiedContentEmail(Content content) throws AmetysRepositoryException
content - the content about which to send the alert.AmetysRepositoryException - if an error occured on the repositoryprotected void _sendReminderEmail(Content content) throws AmetysRepositoryException
content - the content about which to send the reminder.AmetysRepositoryException - if an error occured on the repositoryprotected void _sendScheduledArchivingReminderEmail(ModifiableContent content) throws AmetysRepositoryException
content - the content about which to send the alert.AmetysRepositoryException - if an error occured on the repositoryprotected String getI18nKeyBody(String bodyI18nKey, Content content)
bodyI18nKey - the original body keycontent - the contentprotected List<String> _getInstantAlertParams(Content content, String message)
content - the content.message - the messageprotected List<String> _getAdditionalParams(Content content)
content - The contentprotected List<String> _getAwaitingValidationParams(Content content)
content - the content.protected List<String> _getUnmodifiedContentParams(Content content)
content - the content.protected List<String> _getReminderParams(Content content)
content - the content.protected List<String> _getScheduledArchivingReminderParams(ModifiableContent content)
content - the content.protected 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 String _getContentUrl(Content content)
content - the content.protected void _removeTimeParts(Calendar calendar)
calendar - the calendar.protected Set<String> _getRightsFromConf(Configuration configuration) throws ConfigurationException
configuration - the configuration.ConfigurationException - if the configuration is not valid.