Class ContentConsistencyEngine
java.lang.Object
org.ametys.cms.content.consistency.ContentConsistencyEngine
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ContentConsistencyEngine
Content consistency engine: generate consistency information for all contents.
Sends a report e-mail if there are inconsistencies.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Handler which tests if exists a "/contents/content" tag. -
Field Summary
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
The ametys object resolver.protected String
The server base URL.protected Context
The avalon context.protected Context
The cocoon environment context.protected I18nUtils
The i18n utils.protected boolean
Is the engine initialized ?protected static final Logger
The logger.protected static final String
The report e-mail will be sent to users who possess this right on the application context.protected String
The content of "from" field in emails.protected ServiceManager
The service manager.protected File
The report directory.protected RightManager
The rights manager.protected SourceResolver
The avalon source resolver.protected UserManager
The users manager. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Check the initialization and throw an exception if not initialized.protected void
_dispose()
Dispose of the resources and looked-up components.protected void
Generate the full consistency report.protected void
Send all the alerts.Get the report e-mail parameters.protected String
_getMailPart
(Map<String, String> parameters) Get a mail part.protected String
_getMailUri
(Map<String, String> parameters) Get the pipeline uri for mail bodyprotected void
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
configure
(Configuration configuration) Configure the engine (called by the scheduler).void
initialize
(ServiceManager manager, Context context) Initialize the alert engine.void
run()
-
Field Details
-
_LOGGER
The logger. -
_MAIL_RIGHT
The report e-mail will be sent to users who possess this right on the application context.- See Also:
-
_context
The avalon context. -
_manager
The service manager. -
_baseUrl
The server base URL. -
_reportDirectory
The report directory. -
_initialized
Is the engine initialized ? -
_environmentContext
The cocoon environment context. -
_ametysResolver
The ametys object resolver. -
_sourceResolver
The avalon source resolver. -
_rightManager
The rights manager. -
_userManager
The users manager. -
_i18nUtils
The i18n utils. -
_mailFrom
The content of "from" field in emails.
-
-
Constructor Details
-
ContentConsistencyEngine
public ContentConsistencyEngine()
-
-
Method Details
-
initialize
public void initialize(ServiceManager manager, Context context) throws ContextException, ServiceException Initialize the alert engine.- Parameters:
manager
- the avalon service manager.context
- the avalon context.- Throws:
ContextException
- if an error occurs retrieving the environment context.ServiceException
- if an error occurs retrieving a component.
-
configure
Configure the engine (called by the scheduler).- Parameters:
configuration
- the component configuration.- Throws:
ConfigurationException
- if an error occurred
-
_checkInitialization
Check the initialization and throw an exception if not initialized. -
run
-
_dispose
Dispose of the resources and looked-up components. -
_generateReports
Send all the alerts. Can be overridden to add alerts.- Throws:
AmetysRepositoryException
- if an error occurs.IOException
- if an error occurred
-
_generateReport
Generate the full consistency report.- Throws:
IOException
- if an i/o error occurs.
-
_sendErrorEmail
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.
-
_getMailPart
Get a mail part.- Parameters:
parameters
- the pipeline parameters.- Returns:
- the mail part.
- Throws:
IOException
- if an error occurred
-
_getMailUri
Get the pipeline uri for mail body- Parameters:
parameters
- the mail paramters- Returns:
- a pipeline uri
-
_getEmailParams
Get the report e-mail parameters.- Returns:
- the e-mail parameters.
-
_sendMails
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.
-