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
SearchCriterionDefinition for ContentSearchable proposing a search criterion (based on a SearchUICriterion).-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static ServiceManagerThe service managerprotected Optional<ContentType>The content type on which this criterion definition applies.protected SearchUICriterionThe SearchUICriterion -
Constructor Summary
ConstructorsConstructorDescriptionContentSearchCriterionDefinition(String id, String pluginName, Optional<Searchable> searchable, SearchUICriterion criterion, Optional<ContentType> contentType, Optional<Validator> validator) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionGets the prefix labels, sometimes useful (such as for displaying all criterion definitions) for grouping information.getEmptyValueQuery(String language, Map<String, Object> contextualParameters) Gets the query for testing the value is emptygetFacetLabel(String value, Map<String, Object> contextualParameters) Get the label of a facet value.getQuery(Object value, Query.Operator operator, String language, Map<String, Object> contextualParameters) Gets the query associated to the given valueGets theSearchUICriterionassociated to this definitionstatic voidsetServiceManager(ServiceManager manager) Set the service manager TheServiceManageris used in the criterion definition to get the search criterion helperSearchCriterionDefinitionis not aComponentand can't have aServiceManageritself.toJSON()Gets the JSON representation of this criterion definitionMethods inherited from class org.ametys.web.frontoffice.search.metamodel.impl.AbstractDefaultSearchCriterionDefinition
dispose, getEnumeratedValues, getSearchable, isEnumerated, isTooBigForStaticEnumeratorMethods 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, setWidgetParametersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.web.frontoffice.search.metamodel.SearchCriterionDefinition
getId, getLabel, getType, getValidator, getWidget, getWidgetParameters
-
Field Details
-
__serviceManager
The service manager -
_searchUICriterion
The SearchUICriterion -
_contentType
The content type on which this criterion definition applies. Can be empty if it applies to all types of contents.
-
-
Constructor Details
-
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 Details
-
getFacetLabel
public Optional<I18nizableText> getFacetLabel(String value, Map<String, Object> contextualParameters) Get the label of a facet value.- Parameters:
value- the facet value.contextualParameters- the contextual parameters- Returns:
- the label, or null if the value does not exist.
-
getSearchUICriterion
Gets theSearchUICriterionassociated to this definition- Returns:
- the
SearchUICriterionassociated to this definition
-
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
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
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
-
setServiceManager
Set the service manager TheServiceManageris used in the criterion definition to get the search criterion helperSearchCriterionDefinitionis not aComponentand can't have aServiceManageritself. AnotherComponenthas to set it- Parameters:
manager- the service manager to set
-