Class DuplicateContentsDetectionSchedulable
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
-
- org.ametys.cms.schedule.AbstractSendingMailSchedulable
-
- org.ametys.cms.duplicate.contents.DuplicateContentsDetectionSchedulable
-
- All Implemented Interfaces:
Schedulable
,LogEnabled
,PluginAware
,Initializable
,Component
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
DuplicateContentsDetectionSchedulable
public class DuplicateContentsDetectionSchedulable extends AbstractSendingMailSchedulable
ASchedulable
job for detecting duplicates.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
-
Field Summary
Fields Modifier and Type Field Description protected String
_baseUrl
The server base URL.protected ContentTypesHelper
_contentTypesHelper
The content types helperprotected ContentTypeExtensionPoint
_cTypeEP
The content type extension pointprotected DuplicateContentsManager
_duplicatesManager
The duplicates manager-
Fields inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_currentUserProvider, _i18nUtils, _mailSender, _sysadminMail, _userHelper
-
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 DuplicateContentsDetectionSchedulable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringBuilder
_createBody(Map<Content,List<Content>> duplicatesMap, Map<Content,List<Content>> nearDuplicatesMap, Map<Content,DuplicateContentsManager.Status> tooComplexMap, boolean hasErrors)
Create the body of the emailprotected StringBuilder
_displayContents(Map<Content,List<Content>> duplicatesMap, Map<Content,List<Content>> nearDuplicatesMap, Map<Content,DuplicateContentsManager.Status> tooComplexMap)
Create StringBuilder used to display contentsprotected StringBuilder
_displayDuplicateContent(Map<Content,List<Content>> duplicatesMap, Map<Content,List<Content>> nearDuplicatesMap, Map<Content,DuplicateContentsManager.Status> tooComplexMap, Content content)
Create StringBuilder used to display a contentprotected void
_doExecute(JobExecutionContext context)
Executes the schedulable.protected I18nizableText
_getErrorMailBody(JobExecutionContext context, Throwable throwable)
Retrieves the body of the error mailprotected I18nizableText
_getErrorMailSubject(JobExecutionContext context)
Retrieves the subject of the error mailprotected I18nizableText
_getSuccessMailBody(JobExecutionContext context)
Retrieves the body of the success mailprotected I18nizableText
_getSuccessMailSubject(JobExecutionContext context)
Retrieves the subject of the success mailprotected boolean
_isMailBodyInHTML(JobExecutionContext context)
Determines if the mail body is in HTMLprotected String
_renderCmsToolLink(Content content)
Render the cms tool linkprotected String
_renderContentTitle(Content content)
Render the content titlevoid
initialize()
void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.cms.schedule.AbstractSendingMailSchedulable
_getRecipient, _sendMail, execute
-
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
-
_duplicatesManager
protected DuplicateContentsManager _duplicatesManager
The duplicates manager
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
The content types helper
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point
-
-
Constructor Detail
-
DuplicateContentsDetectionSchedulable
public DuplicateContentsDetectionSchedulable()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSendingMailSchedulable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAbstractSendingMailSchedulable
- Throws:
Exception
-
_doExecute
protected void _doExecute(JobExecutionContext context) throws Exception
Description copied from class:AbstractSendingMailSchedulable
Executes the schedulable.- Specified by:
_doExecute
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Throws:
Exception
- if an error occurred
-
_getSuccessMailSubject
protected I18nizableText _getSuccessMailSubject(JobExecutionContext context) throws Exception
Description copied from class:AbstractSendingMailSchedulable
Retrieves the subject of the success mail- Specified by:
_getSuccessMailSubject
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
- the subject of the success mail
- Throws:
Exception
- If an error occurs while building the mail subject
-
_isMailBodyInHTML
protected boolean _isMailBodyInHTML(JobExecutionContext context)
Description copied from class:AbstractSendingMailSchedulable
Determines if the mail body is in HTML- Overrides:
_isMailBodyInHTML
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
true
if the mail body is in HTML,false
otherwise
-
_getSuccessMailBody
protected I18nizableText _getSuccessMailBody(JobExecutionContext context) throws Exception
Description copied from class:AbstractSendingMailSchedulable
Retrieves the body of the success mail- Specified by:
_getSuccessMailBody
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
- the body of the success mail
- Throws:
Exception
- If an error occurs while building the mail body
-
_createBody
protected StringBuilder _createBody(Map<Content,List<Content>> duplicatesMap, Map<Content,List<Content>> nearDuplicatesMap, Map<Content,DuplicateContentsManager.Status> tooComplexMap, boolean hasErrors)
Create the body of the email- Parameters:
duplicatesMap
- map linking a content to his duplicatesnearDuplicatesMap
- map linking a content to his near duplicatestooComplexMap
- map linking a content to his search status (used to know if a query failed because the fuzzy query was too complex for example)hasErrors
- true if the configuration have some errors- Returns:
- the body
-
_displayContents
protected StringBuilder _displayContents(Map<Content,List<Content>> duplicatesMap, Map<Content,List<Content>> nearDuplicatesMap, Map<Content,DuplicateContentsManager.Status> tooComplexMap)
Create StringBuilder used to display contents- Parameters:
duplicatesMap
- map linking a content to his duplicatesnearDuplicatesMap
- map linking a content to his near duplicatestooComplexMap
- map linking a content to his search status (used to know if a query failed because the fuzzy query was too complex for example)- Returns:
- the StringBuilder used to display contents
-
_displayDuplicateContent
protected StringBuilder _displayDuplicateContent(Map<Content,List<Content>> duplicatesMap, Map<Content,List<Content>> nearDuplicatesMap, Map<Content,DuplicateContentsManager.Status> tooComplexMap, Content content)
Create StringBuilder used to display a content- Parameters:
duplicatesMap
- map linking a content to his duplicatesnearDuplicatesMap
- map linking a content to his near duplicatestooComplexMap
- map linking a content to his search status (used to know if a query failed because the fuzzy query was too complex for example)content
- the content- Returns:
- the StringBuilder used to display a content
-
_renderContentTitle
protected String _renderContentTitle(Content content)
Render the content title- Parameters:
content
- The content- Returns:
- the link
-
_renderCmsToolLink
protected String _renderCmsToolLink(Content content)
Render the cms tool link- Parameters:
content
- The content- Returns:
- the link
-
_getErrorMailSubject
protected I18nizableText _getErrorMailSubject(JobExecutionContext context) throws Exception
Description copied from class:AbstractSendingMailSchedulable
Retrieves the subject of the error mail- Specified by:
_getErrorMailSubject
in classAbstractSendingMailSchedulable
- Parameters:
context
- the context- Returns:
- the subject of the error mail
- Throws:
Exception
- If an error occurs while building the mail subject
-
_getErrorMailBody
protected I18nizableText _getErrorMailBody(JobExecutionContext context, Throwable throwable) throws Exception
Description copied from class:AbstractSendingMailSchedulable
Retrieves the body of the error mail- Specified by:
_getErrorMailBody
in classAbstractSendingMailSchedulable
- Parameters:
context
- the contextthrowable
- the error- Returns:
- the body of the error mail
- Throws:
Exception
- If an error occurs while building the mail body
-
-