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 Modifier and Type Class Description protected classCheckContentConsistencySchedulable.ContentExistsHandlerHandler which tests if exists a "/contents/content" tag.-
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver_ametysResolverThe ametys object resolver.protected String_baseUrlThe server base URL.protected I18nUtils_i18nUtilsThe i18n utils.protected static String_MAIL_RIGHTThe report e-mail will be sent to users who possess this right on the application context.protected String_mailFromThe content of "from" field in emails.protected File_reportDirectoryThe report directory.protected RightManager_rightManagerThe rights manager.protected SourceResolver_sourceResolverThe avalon source resolver.-
Fields inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
_acceptConcurrentExecution, _context, _description, _iconGlyph, _iconLarge, _iconMedium, _iconSmall, _id, _label, _parameters, _pluginName, _private, _schedulableParameterTypeExtensionPoint, _smanager, _userManager
-
-
Constructor Summary
Constructors Constructor Description CheckContentConsistencySchedulable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_generateReport()Generate the full consistency report.protected Map<String,String>_getEmailParams()Get the report e-mail parameters.protected String_getMailPart(Map<String,String> parameters)Get a mail part.protected I18nizableText_getMailSubject(Map<String,String> parameters)Retrieves the mail's subjectprotected String_getMailUri(Map<String,String> parameters)Get the pipeline uri for mail bodyprotected File_getReportDirectory()Retrieves the directory where to generate the reportprotected String_getReportURL()Retrieves the URL of the source to resolve to generate the reportprotected void_sendErrorEmail()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)Send the alert emails.voidexecute(JobExecutionContext context)The action to perform when a trigger is fired.voidinitialize()voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, configure, contextualize, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, isPrivate, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_MAIL_RIGHT
protected static final String _MAIL_RIGHT
The report e-mail will be sent to users who possess this right on the application context.- See Also:
- Constant Field Values
-
_reportDirectory
protected File _reportDirectory
The report directory.
-
_ametysResolver
protected AmetysObjectResolver _ametysResolver
The ametys object resolver.
-
_sourceResolver
protected SourceResolver _sourceResolver
The avalon source resolver.
-
_rightManager
protected RightManager _rightManager
The rights manager.
-
_i18nUtils
protected I18nUtils _i18nUtils
The i18n utils.
-
-
Constructor Detail
-
CheckContentConsistencySchedulable
public CheckContentConsistencySchedulable()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractStaticSchedulable- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
execute
public void execute(JobExecutionContext context) 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- Specified by:
executein classAbstractStaticSchedulable- Parameters:
context- the context- Throws:
Exception- if an error occured
-
_generateReport
protected void _generateReport() throws IOException
Generate the full consistency report.- Throws:
IOException- if an i/o error occurs.
-
_getReportDirectory
protected File _getReportDirectory()
Retrieves the directory where to generate the report- Returns:
- the directory where to generate the report
-
_getReportURL
protected String _getReportURL()
Retrieves the URL of the source to resolve to generate the report- Returns:
- the URL of the source to resolve to generate the report
-
_sendErrorEmail
protected void _sendErrorEmail() throws IOException
Send a reminder e-mail to all the users who have the right to edit.- Throws:
IOException- if an error occurs building or sending the mail.
-
_getMailSubject
protected I18nizableText _getMailSubject(Map<String,String> parameters)
Retrieves the mail's subject- Parameters:
parameters- the mail parameters.- Returns:
- the mail's subject
-
_getMailPart
protected String _getMailPart(Map<String,String> parameters) throws IOException
Get a mail part.- Parameters:
parameters- the mail parameters.- Returns:
- the mail part.
- Throws:
IOException- if an error occurred
-
_getMailUri
protected String _getMailUri(Map<String,String> parameters)
Get the pipeline uri for mail body- Parameters:
parameters- the mail paramters- Returns:
- a pipeline uri
-
_getEmailParams
protected Map<String,String> _getEmailParams()
Get the report e-mail parameters.- Returns:
- the e-mail parameters.
-
_sendMails
protected void _sendMails(String subject, String body, Set<UserIdentity> users, String from)
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.
-
-