Class ContentSearchCriterionDefinition
- java.lang.Object
-
- org.ametys.runtime.parameter.Parameter<MetadataType>
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractDefaultSearchCriterionDefinition
-
- org.ametys.web.frontoffice.search.metamodel.impl.ContentSearchCriterionDefinition
-
- All Implemented Interfaces:
SearchCriterionDefinition
- Direct Known Subclasses:
ContentAttributeContentSearchCriterionDefinition
,TagSearchCriterionDefinition
public class ContentSearchCriterionDefinition extends AbstractDefaultSearchCriterionDefinition
SearchCriterionDefinition
forContentSearchable
proposing a search criterion (based on aSearchUICriterion
).
-
-
Field Summary
Fields Modifier and Type Field Description protected Optional<ContentType>
_contentType
The content type on which this criterion definition applies.protected SearchUICriterion
_searchUICriterion
The SearchUICriterion
-
Constructor Summary
Constructors Constructor Description ContentSearchCriterionDefinition(String id, String pluginName, Optional<Searchable> searchable, SearchUICriterion criterion, Optional<ContentType> contentType, Optional<Validator> validator)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<I18nizableText>
getContextPrefixLabels()
Gets the prefix labels, sometimes useful (such as for displaying all criterion definitions) for grouping information.Query
getEmptyValueQuery(String language, Map<String,Object> contextualParameters)
Gets the query for testing the value is emptyQuery
getQuery(Object value, Query.Operator operator, String language, Map<String,Object> contextualParameters)
Gets the query associated to the given valueSearchUICriterion
getSearchUICriterion()
Gets theSearchUICriterion
associated to this definitionMap<String,Object>
toJSON()
Gets the JSON representation of this criterion definition-
Methods inherited from class org.ametys.web.frontoffice.search.metamodel.impl.AbstractDefaultSearchCriterionDefinition
dispose, getEnumeratedValues, getSearchable, isEnumerated, isTooBigForStaticEnumerator
-
Methods inherited from class org.ametys.runtime.parameter.Parameter
getDefaultValue, getDescription, getEnumerator, getId, getLabel, getPluginName, getType, getValidator, getWidget, getWidgetParameters, setDefaultValue, setDescription, setEnumerator, setId, setLabel, setPluginName, setType, setValidator, setWidget, setWidgetParameters
-
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.SearchCriterionDefinition
getId, getLabel, getType, getValidator, getWidget, getWidgetParameters
-
-
-
-
Field Detail
-
_searchUICriterion
protected SearchUICriterion _searchUICriterion
The SearchUICriterion
-
_contentType
protected Optional<ContentType> _contentType
The content type on which this criterion definition applies. Can be empty if it applies to all types of contents.
-
-
Constructor Detail
-
ContentSearchCriterionDefinition
public ContentSearchCriterionDefinition(String id, String pluginName, Optional<Searchable> searchable, SearchUICriterion criterion, Optional<ContentType> contentType, Optional<Validator> validator)
Default constructor- Parameters:
id
- The idpluginName
- The plugin namesearchable
- theSearchable
criterion
- The linkedSearchUICriterion
contentType
- The content type on which this criterion definition applies. Can be empty if it applies to all types of contents.validator
- The validator
-
-
Method Detail
-
getSearchUICriterion
public SearchUICriterion getSearchUICriterion()
Gets theSearchUICriterion
associated to this definition- Returns:
- the
SearchUICriterion
associated to this definition
-
getContextPrefixLabels
public List<I18nizableText> getContextPrefixLabels()
Description copied from interface:SearchCriterionDefinition
Gets the prefix labels, sometimes useful (such as for displaying all criterion definitions) for grouping information.- Returns:
- The prefix labels (can be empty)
-
toJSON
public Map<String,Object> toJSON() throws Exception
Description copied from interface:SearchCriterionDefinition
Gets the JSON representation of this criterion definition- Specified by:
toJSON
in interfaceSearchCriterionDefinition
- Overrides:
toJSON
in classAbstractDefaultSearchCriterionDefinition
- Returns:
- the JSON representation of this criterion definition
- Throws:
Exception
- if an exception occurs
-
getQuery
public Query getQuery(Object value, Query.Operator operator, String language, Map<String,Object> contextualParameters)
Description copied from interface:SearchCriterionDefinition
Gets the query associated to the given value- Parameters:
value
- the valueoperator
- the operatorlanguage
- The current search language.contextualParameters
- the search contextual parameters.- Returns:
- the query associated to the given value
-
getEmptyValueQuery
public Query getEmptyValueQuery(String language, Map<String,Object> contextualParameters)
Description copied from interface:SearchCriterionDefinition
Gets the query for testing the value is empty- Parameters:
language
- The current search language.contextualParameters
- the search contextual parameters.- Returns:
- the query for testing the value is empty
-
-