Class CheckContentConsistencySchedulable
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
org.ametys.cms.content.consistency.CheckContentConsistencySchedulable
- All Implemented Interfaces:
Schedulable
,LogEnabled
,PluginAware
,Initializable
,Component
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
CheckContentConsistencySchedulable
public class CheckContentConsistencySchedulable
extends AbstractStaticSchedulable
implements Initializable
Content consistency schedulable: generate consistency information for all contents.
Sends a report e-mail if there are inconsistencies.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Id of progression tracker for notificationsprotected static final String
Id of progression tracker for consistensy reportprotected static final String
The report e-mail will be sent to users who possess this right on the application context.protected AmetysObjectResolver
The ametys object resolver.protected String
The server base URL.protected ContentConsistencyManager
The content consistency managerprotected I18nUtils
The i18n utils.protected String
The content of "from" field in emails.protected File
The report directory.protected RightManager
The rights manager.protected SourceResolver
The avalon source resolver.static final String
Id of progression tracker for removing outdated resultsstatic final String
Id of progression tracker for removing outdated resultsFields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Retrieves the mail's bodyprotected I18nizableText
Retrieves the mail's subjectprotected String
Get the report URIprotected void
_sendEmail
(ContentConsistencyManager.ConsistenciesReport report, Set<UserIdentity> users, SimpleProgressionTracker progressionTracker) Send a reminder e-mail to all the users who have the right to edit.protected void
_sendMails
(String subject, String body, Set<UserIdentity> users, String from, InputStream attachment, SimpleProgressionTracker progressionTracker) Send the alert e-mails.void
execute
(JobExecutionContext context, ContainerProgressionTracker progressionTracker) The action to perform when a trigger is fired.protected Set<UserIdentity>
Compute the list of user to notifyvoid
void
service
(ServiceManager manager) Methods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, configure, contextualize, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, getProgressionTracker, isPrivate, setPluginInfo
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
REMOVE_OUTDATED_RESULT
Id of progression tracker for removing outdated results- See Also:
-
CHECK_CONTENTS
Id of progression tracker for removing outdated results- See Also:
-
__MAIL_RIGHT
The report e-mail will be sent to users who possess this right on the application context.- See Also:
-
__CHECK_CONTENT_CONSISTENCY_NOTIFICATION
Id of progression tracker for notifications- See Also:
-
__CHECK_CONTENT_CONSISTENCY_REPORT
Id of progression tracker for consistensy report- See Also:
-
_baseUrl
The server base URL. -
_reportDirectory
The report directory. -
_ametysResolver
The ametys object resolver. -
_sourceResolver
The avalon source resolver. -
_rightManager
The rights manager. -
_i18nUtils
The i18n utils. -
_mailFrom
The content of "from" field in emails. -
_contentConsistencyManager
The content consistency manager
-
-
Constructor Details
-
CheckContentConsistencySchedulable
public CheckContentConsistencySchedulable()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractStaticSchedulable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
execute
public void execute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) throws Exception Description copied from interface:Schedulable
The action to perform when a trigger is fired. Do not manually call this method.- Specified by:
execute
in interfaceSchedulable
- Parameters:
context
- the contextprogressionTracker
- The progression tracker- Throws:
Exception
- if an error occurred
-
_sendEmail
protected void _sendEmail(ContentConsistencyManager.ConsistenciesReport report, Set<UserIdentity> users, SimpleProgressionTracker progressionTracker) throws IOException, ProcessingException Send a reminder e-mail to all the users who have the right to edit.- Parameters:
report
- the consistency reportusers
- the users to notifyprogressionTracker
- the progression tracker for sending email- Throws:
IOException
- if an error occurs building or sending the mail.ProcessingException
- if an error occurs
-
getUsersToNotify
Compute the list of user to notify- Returns:
- a list of user identity
-
_getMailSubject
Retrieves the mail's subject- Parameters:
report
- the consistency report- Returns:
- the mail's subject
-
_getMailBody
Retrieves the mail's body- Parameters:
report
- the consistency report- Returns:
- the mail's body
-
_getReportUri
Get the report URI- Returns:
- the report uri
-
_sendMails
protected void _sendMails(String subject, String body, Set<UserIdentity> users, String from, InputStream attachment, SimpleProgressionTracker progressionTracker) Send the alert e-mails.- 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.attachment
- the e-mail attachmentprogressionTracker
- progression tracker for sending report mail
-