Class AbstractContentBasedReturnable
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdder
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdderReturnable
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractContentBasedReturnable
-
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Returnable
,Initializable
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
ContentReturnable
,CourseReturnable
,PrivateContentReturnable
,ProgramReturnable
public abstract class AbstractContentBasedReturnable extends AbstractParameterAdderReturnable implements Contextualizable, Initializable
Abstract class for allReturnable
based onContent
s
-
-
Field Summary
Fields Modifier and Type Field Description private static List<String>
__EXCLUDED_SYSPROP_SORT_DEFINITIONS
protected AbstractContentBasedSearchable
_associatedContentSearchable
The associated content searchableprotected ContentFilterHelper
_contentFilterHelper
The content filter helperprotected ContentHelper
_contentHelper
The content helperprotected Context
_context
The contextprotected I18nizableText
_label
The labelprotected SearchableExtensionPoint
_searchableEP
The extension point for searchables-
Fields inherited from class org.ametys.web.frontoffice.search.metamodel.impl.AbstractParameterAdder
_manager, _pluginName
-
-
Constructor Summary
Constructors Constructor Description AbstractContentBasedReturnable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private boolean
_isExcludedSortDefinition(SearchCriterionDefinition criterionDefinition)
private boolean
_isSortable(ContentSearchCriterionDefinition criterionDefinition)
protected void
_setAssociatedContentSearchable()
protected abstract String
associatedContentSearchableRole()
The Avalon Role for the associated Content Searchablevoid
configure(Configuration configuration)
void
contextualize(Context context)
Query
filterReturnedDocumentQuery(Collection<ContextQueriesWrapper> contextQueriesWrappers, AdditionalParameterValueMap additionalParameterValues)
Returns the query to execute in order to filter returned objects (according to their type) during the search.protected abstract Collection<String>
getContentTypes(AdditionalParameterValueMap additionalParameterValues)
Gets the content types which will be used to construct the query to filter the returned documentsprotected abstract String
getDefinitionPrefix()
Gets the prefix for definitions (for facets, sorts...)Collection<FacetDefinition>
getFacets(AdditionalParameterValueMap additionalParameterValues)
Gets the facetsI18nizableText
getLabel()
Gets the label of the type of resultCollection<SortDefinition>
getSorts(AdditionalParameterValueMap additionalParameterValues)
Gets the sortsvoid
initialize()
protected SearchContext.LangQueryProducer
langQueryProducer()
The producer of the lang queryCollection<Searchable>
relationsWith()
Retrieves the relations the type must have with someSearchable
s.void
service(ServiceManager manager)
protected Function<Query,Query>
sitemapQueryJoiner()
The joiner for the sitemap queryprotected Function<Query,Query>
siteQueryJoiner()
The joiner for the site queryprotected Function<Query,Query>
tagQueryJoiner()
The joiner for the tag query-
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.web.frontoffice.search.metamodel.Returnable
additionalServiceParameters, getId, getSaxer, selectedByDefault
-
-
-
-
Field Detail
-
__EXCLUDED_SYSPROP_SORT_DEFINITIONS
private static final List<String> __EXCLUDED_SYSPROP_SORT_DEFINITIONS
-
_contentFilterHelper
protected ContentFilterHelper _contentFilterHelper
The content filter helper
-
_contentHelper
protected ContentHelper _contentHelper
The content helper
-
_searchableEP
protected SearchableExtensionPoint _searchableEP
The extension point for searchables
-
_associatedContentSearchable
protected AbstractContentBasedSearchable _associatedContentSearchable
The associated content searchable
-
_label
protected I18nizableText _label
The label
-
-
Constructor Detail
-
AbstractContentBasedReturnable
public AbstractContentBasedReturnable()
-
-
Method Detail
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractParameterAdder
- Throws:
ConfigurationException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractParameterAdder
- Throws:
ServiceException
-
_setAssociatedContentSearchable
protected void _setAssociatedContentSearchable()
Sets_associatedContentSearchable
. Called duringinitialize()
-
associatedContentSearchableRole
protected abstract String associatedContentSearchableRole()
The Avalon Role for the associated Content Searchable- Returns:
- The Avalon Role for the associated Content Searchable
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getLabel
public I18nizableText getLabel()
Description copied from interface:Returnable
Gets the label of the type of result- Specified by:
getLabel
in interfaceReturnable
- Returns:
- the label of the type of result
-
filterReturnedDocumentQuery
public Query filterReturnedDocumentQuery(Collection<ContextQueriesWrapper> contextQueriesWrappers, AdditionalParameterValueMap additionalParameterValues)
Description copied from interface:Returnable
Returns the query to execute in order to filter returned objects (according to their type) during the search.
It should callContextQueriesWrapper#getQuery
in order to make aJoinQuery
on interesting parts ofContextQueriesWrapper
s and then constructs anAndQuery
composed of aDocumentTypeQuery
and the result of the call.- Specified by:
filterReturnedDocumentQuery
in interfaceReturnable
- Parameters:
contextQueriesWrappers
- The contextqueries
additionalParameterValues
- The additional parameter values- Returns:
- the query to execute in order to filter returned objects (according to their type) during the search.
-
siteQueryJoiner
protected Function<Query,Query> siteQueryJoiner()
The joiner for the site query- Returns:
- The joiner for the site query
-
sitemapQueryJoiner
protected Function<Query,Query> sitemapQueryJoiner()
The joiner for the sitemap query- Returns:
- The joiner for the sitemap query
-
langQueryProducer
protected SearchContext.LangQueryProducer langQueryProducer()
The producer of the lang query- Returns:
- The producer of the lang query
-
tagQueryJoiner
protected Function<Query,Query> tagQueryJoiner()
The joiner for the tag query- Returns:
- The joiner for the tag query
-
getContentTypes
protected abstract Collection<String> getContentTypes(AdditionalParameterValueMap additionalParameterValues)
Gets the content types which will be used to construct the query to filter the returned documents- Parameters:
additionalParameterValues
- The additional parameter values- Returns:
- the content types which will be used to construct the query to filter the returned documents
-
getFacets
public Collection<FacetDefinition> getFacets(AdditionalParameterValueMap additionalParameterValues)
Description copied from interface:Returnable
Gets the facets- Specified by:
getFacets
in interfaceReturnable
- Parameters:
additionalParameterValues
- The additional parameter values- Returns:
- the facets
-
getSorts
public Collection<SortDefinition> getSorts(AdditionalParameterValueMap additionalParameterValues)
Description copied from interface:Returnable
Gets the sorts- Specified by:
getSorts
in interfaceReturnable
- Parameters:
additionalParameterValues
- The additional parameter values- Returns:
- the sorts
-
getDefinitionPrefix
protected abstract String getDefinitionPrefix()
Gets the prefix for definitions (for facets, sorts...)- Returns:
- the prefix for definitions
-
_isSortable
private boolean _isSortable(ContentSearchCriterionDefinition criterionDefinition)
-
_isExcludedSortDefinition
private boolean _isExcludedSortDefinition(SearchCriterionDefinition criterionDefinition)
-
relationsWith
public Collection<Searchable> relationsWith()
Description copied from interface:Returnable
Retrieves the relations the type must have with someSearchable
s.
It does not have to be exhaustive (for instance ifSearchable.relationsWith()
declares the relation, it is useless to declare it twice)- Specified by:
relationsWith
in interfaceReturnable
- Returns:
- some relations the type must have with some
Searchable
s
-
-