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
FieldsModifier and TypeFieldDescriptionprotected static final StringId of progression tracker for notificationsprotected static final StringId of progression tracker for consistensy reportprotected static final StringThe report e-mail will be sent to users who possess this right on the application context.protected AmetysObjectResolverThe ametys object resolver.protected StringThe server base URL.protected ContentConsistencyManagerThe content consistency managerprotected I18nUtilsThe i18n utils.protected StringThe content of "from" field in emails.protected FileThe report directory.protected RightManagerThe rights manager.protected SourceResolverThe avalon source resolver.static final StringId of progression tracker for removing outdated resultsstatic final StringId 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringRetrieves the mail's bodyprotected I18nizableTextRetrieves the mail's subjectprotected StringGet 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.voidexecute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) The action to perform when a trigger is fired.protected Set<UserIdentity>Compute the list of user to notifyvoidvoidservice(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, setPluginInfoMethods 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:
servicein interfaceServiceable- Overrides:
servicein classAbstractStaticSchedulable- Throws:
ServiceException
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
execute
public void execute(JobExecutionContext context, ContainerProgressionTracker progressionTracker) throws Exception Description copied from interface:SchedulableThe action to perform when a trigger is fired. Do not manually call this method.- Specified by:
executein 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
-