Class AbstractContentBasedSearchable
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdder
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdderSearchable
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractContentBasedSearchable
-
- All Implemented Interfaces:
Cacheable,LogEnabled,PluginAware,Searchable,Disposable,Initializable,Configurable,Contextualizable,Serviceable
- Direct Known Subclasses:
ContentSearchable,CourseSearchable,PrivateContentSearchable,ProgramSearchable
public abstract class AbstractContentBasedSearchable extends AbstractParameterAdderSearchable implements Initializable, Contextualizable, Disposable, Cacheable
Abstract class for allSearchablebased onContents
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classAbstractContentBasedSearchable.ContentTypeComparatorprivate static classAbstractContentBasedSearchable.CriterionDefinitionAndSourceContentType-
Nested classes/interfaces inherited from interface org.ametys.core.util.Cacheable
Cacheable.SingleCacheConfiguration
-
-
Field Summary
-
Fields inherited from class org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdder
_manager, _pluginName
-
-
Constructor Summary
Constructors Constructor Description AbstractContentBasedSearchable()
-
Method Summary
-
Methods inherited from class org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdder
additionalServiceParameters, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.core.util.Cacheable
createCaches, getCache, isCachingEnabled, removeCaches
-
Methods inherited from interface org.ametys.web.frontoffice.search.metamodel.Searchable
additionalServiceParameters, joinQuery
-
-
-
-
Field Detail
-
__EXCLUDED_SYSTEM_PROPERTIES
private static final List<String> __EXCLUDED_SYSTEM_PROPERTIES
-
__EXCLUDED_INDEXING_FIELD
private static final List<String> __EXCLUDED_INDEXING_FIELD
-
__SEARCH_CRITERION_CACHE_ID
private static final String __SEARCH_CRITERION_CACHE_ID
-
_label
protected I18nizableText _label
The label
-
_criteriaPosition
protected int _criteriaPosition
The criteria position
-
_pageReturnable
protected Returnable _pageReturnable
The page returnable
-
_associatedContentReturnable
protected Returnable _associatedContentReturnable
The associated content returnable
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The extension point for content types
-
_returnableEP
private ReturnableExtensionPoint _returnableEP
-
_systemPropertyEP
private SystemPropertyExtensionPoint _systemPropertyEP
-
_ametysObjectResolver
private AmetysObjectResolver _ametysObjectResolver
-
_tagProviderEP
private TagProviderExtensionPoint _tagProviderEP
-
_jsonUtils
private JSONUtils _jsonUtils
-
_abstractCacheManager
private AbstractCacheManager _abstractCacheManager
-
_systemPropertySearchCriterionDefs
private List<ContentSearchCriterionDefinition> _systemPropertySearchCriterionDefs
-
_titleIndexingFieldSearchCriterionDefCache
private ContentSearchCriterionDefinition _titleIndexingFieldSearchCriterionDefCache
-
_managers
private Set<ThreadSafeComponentManager<?>> _managers
-
-
Constructor Detail
-
AbstractContentBasedSearchable
public AbstractContentBasedSearchable()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractParameterAdder- Throws:
ConfigurationException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractParameterAdder- Throws:
ServiceException
-
_setAssociatedContentReturnable
protected void _setAssociatedContentReturnable()
Sets_associatedContentReturnable. Called duringinitialize()
-
associatedContentReturnableRole
protected abstract String associatedContentReturnableRole()
The Avalon Role for the associated Content Returnable- Returns:
- The Avalon Role for the associated Content Returnable
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
getCacheManager
public AbstractCacheManager getCacheManager()
Description copied from interface:CacheableReturns the instance of the implementation ofAbstractCacheManagerto use.
This is not meant to be called manually.- Specified by:
getCacheManagerin interfaceCacheable- Returns:
- The
AbstractCacheManagerto bind
-
getManagedCaches
public Collection<Cacheable.SingleCacheConfiguration> getManagedCaches()
Description copied from interface:CacheableGets the managed caches.
This is meant to be implemented in order to describe the managed caches and automatically create and remove the corresponding caches inCacheable.createCaches()andCacheable.removeCaches()default methods.
This is not meant to be called manually.- Specified by:
getManagedCachesin interfaceCacheable- Returns:
- A collection of
Cacheable.SingleCacheConfigurations to manage
-
hasComputableSize
public boolean hasComputableSize()
Description copied from interface:CacheableDetermines if the cache has a computable size. This operation can be very slow.- Specified by:
hasComputableSizein interfaceCacheable- Returns:
trueif we can compute the size on the cache.
-
_buildI18n
private I18nizableText _buildI18n(String i18Key)
-
getSearchCriterionCache
private Cache<String,Collection<AbstractContentBasedSearchable.CriterionDefinitionAndSourceContentType>> getSearchCriterionCache()
-
_getSystemPropSearchCriterionDef
private ContentSearchCriterionDefinition _getSystemPropSearchCriterionDef(String propId)
-
_criterionDefinition
private ContentSearchCriterionDefinition _criterionDefinition(String id, SearchUICriterion criterion)
-
getSystemPropertyCriterionDefinitionPrefix
protected String getSystemPropertyCriterionDefinitionPrefix()
Gets the prefix for the ids of system property criterion definitions- Returns:
- the prefix for the ids of system property criterion definitions
-
getCriterionDefinitionPrefix
protected abstract String getCriterionDefinitionPrefix()
Gets the prefix for criterion definitions- Returns:
- the prefix for criterion definitions
-
_getSystemCriteriaConfiguration
private Configuration _getSystemCriteriaConfiguration(String propertyId)
-
dispose
public void dispose()
- Specified by:
disposein interfaceDisposable
-
getLabel
public I18nizableText getLabel()
Description copied from interface:SearchableGets the label of the searchable- Specified by:
getLabelin interfaceSearchable- Returns:
- the label of the searchable
-
criteriaPosition
public int criteriaPosition()
Description copied from interface:SearchableThe position of the criteria provided by thisSearchableamong criteria provided by otherSearchables.
All criteria provided by the sameSearchableare always packed together, this integer just affects the relative position compared to otherSearchablecriteria.
The lowest the integer, the higher it will appear in the UI.- Specified by:
criteriaPositionin interfaceSearchable- Returns:
- The position of the criteria of this
Searchable
-
getCriteria
public Collection<SearchCriterionDefinition> getCriteria(AdditionalParameterValueMap additionalParameterValues)
Description copied from interface:SearchableGets the criteria- Specified by:
getCriteriain interfaceSearchable- Parameters:
additionalParameterValues- The additional parameter values- Returns:
- the criteria
-
getContentTypes
protected abstract Collection<String> getContentTypes(AdditionalParameterValueMap additionalParameterValues)
Gets the content types which will be used to retrieve the criteria relative to the Indexing Model- Parameters:
additionalParameterValues- The additional parameter values- Returns:
- the content types which will be used to retrieve the criteria relative to the Indexing Model
-
_getIndexingFieldSearchCriterionDefs
private Collection<AbstractContentBasedSearchable.CriterionDefinitionAndSourceContentType> _getIndexingFieldSearchCriterionDefs(Collection<String> contentTypeIds)
-
_getIndexingFieldSearchCriterionDefs
private Collection<AbstractContentBasedSearchable.CriterionDefinitionAndSourceContentType> _getIndexingFieldSearchCriterionDefs(String contentTypeId)
-
_getIndexingFields
private Collection<IndexingField> _getIndexingFields(ContentType contentType)
-
_createIndexingFieldSearchCriterionDefs
private Collection<AbstractContentBasedSearchable.CriterionDefinitionAndSourceContentType> _createIndexingFieldSearchCriterionDefs(Collection<IndexingField> indexingModelFields, ContentType requestedContentType)
-
_getReferenceContentType
private ContentType _getReferenceContentType(MetadataIndexingField indexingField, ContentType requestedContentType)
-
_getValidator
private Optional<Validator> _getValidator(ContentType contentType, String itemPath)
-
_criterionDefinition
private ContentSearchCriterionDefinition _criterionDefinition(String id, SearchUICriterion criterion, ContentType fromContentType, Optional<Validator> validator)
-
_finalIndexingFieldCriterionDefs
private Collection<ContentSearchCriterionDefinition> _finalIndexingFieldCriterionDefs(Collection<AbstractContentBasedSearchable.CriterionDefinitionAndSourceContentType> indexingFieldCriterionDefs)
-
_getTitleIndexingFieldSearchCriterionDef
private ContentSearchCriterionDefinition _getTitleIndexingFieldSearchCriterionDef()
-
_createTitleIndexingFieldSearchCriterionDef
private ContentSearchCriterionDefinition _createTitleIndexingFieldSearchCriterionDef()
-
getIndexingFieldCriterionDefinitionPrefix
protected String getIndexingFieldCriterionDefinitionPrefix()
Gets the prefix for the ids of indexing field criterion definitions- Returns:
- the prefix for the ids of indexing field criterion definitions
-
_getIndexingFieldCriteriaConfiguration
private Configuration _getIndexingFieldCriteriaConfiguration(String path, Optional<String> contentTypeId)
-
relationsWith
public Collection<Returnable> relationsWith()
Description copied from interface:SearchableRetrieves the relations the type must have with someReturnables.
It does not have to be exhaustive (for instance ifReturnable.relationsWith()declares the relation, it is useless to declare it twice)- Specified by:
relationsWithin interfaceSearchable- Returns:
- some relations the type must have with some
Returnables
-
-