Class AbstractDefaultSearchCriterionDefinition
- java.lang.Object
-
- org.ametys.runtime.parameter.Parameter<MetadataType>
-
- org.ametys.web.frontoffice.search.metamodel.impl.AbstractDefaultSearchCriterionDefinition
-
- All Implemented Interfaces:
SearchCriterionDefinition
- Direct Known Subclasses:
ContentSearchCriterionDefinition
,DublinCoreSearchCriterionDefinition
,PageSearchCriterionDefinition
,PageTitleSearchCriterionDefinition
,SitemapSearchCriterionDefinition
,SiteSearchCriterionDefinition
,WordingSearchCriterionDefinition
public abstract class AbstractDefaultSearchCriterionDefinition extends Parameter<MetadataType> implements SearchCriterionDefinition
Default implementation ofSearchCriterionDefinition
-
-
Field Summary
Fields Modifier and Type Field Description private Optional<Searchable>
_searchable
-
Constructor Summary
Constructors Constructor Description AbstractDefaultSearchCriterionDefinition(String id, String pluginName, I18nizableText label, MetadataType type, Optional<String> widget, Optional<Map<String,I18nizableText>> widgetParams, Optional<Enumerator> enumerator, Optional<Validator> validator, Optional<Object> defaultValue, Optional<Searchable> searchable)
Constructs aSearchCriterionDefinition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
dispose()
Releases and destroys any resource it owns.Optional<EnumeratedValues>
getEnumeratedValues(Map<String,Object> contextualParameters)
Gets the enumerated entries.Optional<Searchable>
getSearchable()
Gets the (Searchable
) the criterion belongs to.boolean
isEnumerated()
Returnstrue
if this criterion definition is enumeratedMap<String,Object>
toJSON()
Gets the JSON representation of this criterion definition-
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
getContextPrefixLabels, getId, getLabel, getQuery, getType, getValidator, getWidget, getWidgetParameters, isTooBigForStaticEnumerator
-
-
-
-
Field Detail
-
_searchable
private Optional<Searchable> _searchable
-
-
Constructor Detail
-
AbstractDefaultSearchCriterionDefinition
public AbstractDefaultSearchCriterionDefinition(String id, String pluginName, I18nizableText label, MetadataType type, Optional<String> widget, Optional<Map<String,I18nizableText>> widgetParams, Optional<Enumerator> enumerator, Optional<Validator> validator, Optional<Object> defaultValue, Optional<Searchable> searchable)
Constructs aSearchCriterionDefinition
- Parameters:
id
- The idpluginName
- The plugin namelabel
- The labeltype
- The typewidget
- The widgetwidgetParams
- The widget parametersenumerator
- The enumeratorvalidator
- The validatordefaultValue
- The default valuesearchable
- theSearchable
-
-
Method Detail
-
getSearchable
public Optional<Searchable> getSearchable()
Description copied from interface:SearchCriterionDefinition
Gets the (Searchable
) the criterion belongs to.
Important: if the criterion definition is brought by a specific Searchable, then this searchable must be returned in a non-emptyOptional
. If the criterion definition is brought bySearchServiceCommonImpls
, then anOptional.empty()
must be returned.- Specified by:
getSearchable
in interfaceSearchCriterionDefinition
- Returns:
- the (
Searchable
) the criterion belongs to.
-
isEnumerated
public boolean isEnumerated()
Description copied from interface:SearchCriterionDefinition
Returnstrue
if this criterion definition is enumerated- Specified by:
isEnumerated
in interfaceSearchCriterionDefinition
- Returns:
true
if this criterion definition is enumerated
-
getEnumeratedValues
public Optional<EnumeratedValues> getEnumeratedValues(Map<String,Object> contextualParameters)
Description copied from interface:SearchCriterionDefinition
Gets the enumerated entries.
Must be non-empty
ifSearchCriterionDefinition.isEnumerated()
returnstrue
.- Specified by:
getEnumeratedValues
in interfaceSearchCriterionDefinition
- Parameters:
contextualParameters
- The contextual parameters- Returns:
- the enumerated entries
-
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
- Returns:
- the JSON representation of this criterion definition
- Throws:
Exception
- if an exception occurs
-
dispose
protected void dispose()
Releases and destroys any resource it owns.
-
-