Class DuplicateContentsManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.duplicate.contents.DuplicateContentsManager
- All Implemented Interfaces:
LogEnabled,Component,Configurable,Serviceable
- Direct Known Subclasses:
DuplicateContentsManager
public class DuplicateContentsManager
extends AbstractLogEnabled
implements Component, Serviceable, Configurable
Component able to detect duplicates (and near duplicates) for a given content.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe status of the query -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentHelperThe content helperprotected ContentSearcherFactoryThe content searcher factory.protected DuplicateContentConfigurationThe duplicate content descriptionstatic final Stringkey for duplicate contents liststatic final Stringkey for near duplicate contents liststatic final Stringkey for boolean to know whether there are some content types or notstatic final StringThe component role.static final Stringkey for boolean to know the query status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_addDuplicatesContentTypes(String[] contentTypeIds) Get the configured duplicates content typesGet the list of configuration errorsGet the list of configuration warnsprotected AmetysObjectIterable<Content> _getContents(Collection<String> contentTypes) Retrieves indexed contents that have at least one of the listed content types_getDuplicates(Content content, Set<DuplicateContentTypeConfiguration> duplicateContentTypeConfigurations, boolean nearDuplicates, String[] contentTypes) Get the list of duplicates_getDuplicatesQueries(Content content, Set<DuplicateContentTypeConfiguration> duplicateContentTypeConfigurations, boolean nearDuplicates, String[] contentTypes) Get the list of queries to search for duplicatesvoidconfigure(Configuration configuration) Get the content types setbooleanReturnstrueif there is at least one configuration errorvoidlogConfigurationErrors(org.slf4j.Logger logger) Log all errors of the configurationGet the data about duplicates and near duplicates for all contents that match the content types included in the configurationsearchDuplicates(Iterable<Content> contents) Get the data about duplicates and near duplicates for a list of contentssearchDuplicates(Content content) Get the data about duplicates and near duplicated for a given contentvoidservice(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role. -
DUPLICATE_CONTENTS_KEY
key for duplicate contents list- See Also:
-
NEAR_DUPLICATE_CONTENTS_KEY
key for near duplicate contents list- See Also:
-
NO_DUPLICATE_CONTENTS_CONTENT_TYPE_KEY
key for boolean to know whether there are some content types or not- See Also:
-
STATUS_KEY
key for boolean to know the query status- See Also:
-
_contentSearcherFactory
The content searcher factory. -
_contentHelper
The content helper -
_duplicateContentConfiguration
The duplicate content description
-
-
Constructor Details
-
DuplicateContentsManager
public DuplicateContentsManager()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
searchDuplicates
Get the data about duplicates and near duplicated for a given content- Parameters:
content- The content- Returns:
- A map of data. key "duplicates" contains a list of the duplicates (id and label for each entry), and key "nearDuplicates" contains the near duplicates if requested (duplicates excluded).
-
searchDuplicates
Get the data about duplicates and near duplicates for all contents that match the content types included in the configuration- Returns:
- the data about duplicates and near duplicates
-
searchDuplicates
Get the data about duplicates and near duplicates for a list of contents- Parameters:
contents- the contents to check- Returns:
- the data about duplicates and near duplicates
-
_getDuplicates
protected List<Content> _getDuplicates(Content content, Set<DuplicateContentTypeConfiguration> duplicateContentTypeConfigurations, boolean nearDuplicates, String[] contentTypes) throws Exception Get the list of duplicates- Parameters:
content- The contentduplicateContentTypeConfigurations- the attribute listnearDuplicates- true to check for near duplicatescontentTypes- the content types- Returns:
- list of duplicates
- Throws:
Exception- if a problem occurs while searching for duplicates
-
_getDuplicatesQueries
protected List<Query> _getDuplicatesQueries(Content content, Set<DuplicateContentTypeConfiguration> duplicateContentTypeConfigurations, boolean nearDuplicates, String[] contentTypes) Get the list of queries to search for duplicates- Parameters:
content- The contentduplicateContentTypeConfigurations- the attribute listnearDuplicates- true to check for near duplicatescontentTypes- the content types- Returns:
- list of duplicates
-
_addDuplicatesContentTypes
Get the configured duplicates content types- Parameters:
contentTypeIds- The content type identifiers for which duplicates content types should be found- Returns:
- the duplicate content types
-
_getContents
Retrieves indexed contents that have at least one of the listed content types- Parameters:
contentTypes- The desired content types- Returns:
- solr query results
-
_getConfigurationErrors
Get the list of configuration errors- Returns:
- the configuration error list
-
_getConfigurationWarns
Get the list of configuration warns- Returns:
- the configuration warn list
-
getContentTypeIds
Get the content types set- Returns:
- the content types set
-
logConfigurationErrors
Log all errors of the configuration- Parameters:
logger- the logger
-
hasConfigurationErrors
Returnstrueif there is at least one configuration error- Returns:
trueif there is at least one configuration error
-