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
SearchCriterionDefinitionforContentSearchableproposing a search criterion (based on aSearchUICriterion).
-
-
Field Summary
Fields Modifier and Type Field Description protected Optional<ContentType>_contentTypeThe content type on which this criterion definition applies.protected SearchUICriterion_searchUICriterionThe 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.QuerygetEmptyValueQuery(String language, Map<String,Object> contextualParameters)Gets the query for testing the value is emptyQuerygetQuery(Object value, Query.Operator operator, String language, Map<String,Object> contextualParameters)Gets the query associated to the given valueSearchUICriteriongetSearchUICriterion()Gets theSearchUICriterionassociated 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- theSearchablecriterion- The linkedSearchUICriterioncontentType- 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 theSearchUICriterionassociated to this definition- Returns:
- the
SearchUICriterionassociated to this definition
-
getContextPrefixLabels
public List<I18nizableText> getContextPrefixLabels()
Description copied from interface:SearchCriterionDefinitionGets 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:SearchCriterionDefinitionGets the JSON representation of this criterion definition- Specified by:
toJSONin interfaceSearchCriterionDefinition- Overrides:
toJSONin 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:SearchCriterionDefinitionGets 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:SearchCriterionDefinitionGets 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
-
-