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 class
CheckContentConsistencySchedulable.ContentExistsHandler
Handler 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
_ametysResolver
The ametys object resolver.protected String
_baseUrl
The server base URL.protected I18nUtils
_i18nUtils
The i18n utils.protected static String
_MAIL_RIGHT
The report e-mail will be sent to users who possess this right on the application context.protected String
_mailFrom
The content of "from" field in emails.protected File
_reportDirectory
The report directory.protected RightManager
_rightManager
The rights manager.protected SourceResolver
_sourceResolver
The 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.void
execute(JobExecutionContext context)
The action to perform when a trigger is fired.void
initialize()
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, 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:
service
in interfaceServiceable
- Overrides:
service
in classAbstractStaticSchedulable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
execute
public void execute(JobExecutionContext context) 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
- Specified by:
execute
in 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.
-
-