Class AbstractSearchUICriterion
java.lang.Object
org.ametys.runtime.parameter.Parameter<MetadataType>
org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
- All Implemented Interfaces:
Field
,SearchCriterion
,SearchUICriterion
,LogEnabled
,Disposable
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AbstractCustomSearchUICriterion
,DynamicWrappedSearchUIModel.WrappedSearchUICriterion
,IndexingFieldAggregatorSearchUICriterion
,IndexingFieldSearchUICriterion
,SystemSearchUICriterion
public abstract class AbstractSearchUICriterion
extends Parameter<MetadataType>
implements SearchUICriterion, Contextualizable, Serviceable, Configurable, Disposable, LogEnabled
This class represents a search criterion of a
SearchUIModel
.-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentHelper
The content type extension point.protected Context
The avalon contextprotected ContentTypeExtensionPoint
The content type extension point.protected ThreadSafeComponentManager<Enumerator>
ComponentManager forEnumerator
s.protected Logger
the loggerprotected ServiceManager
The service managerprotected AmetysObjectResolver
The ametys object resolver.protected UserManager
The user manager.protected UserPopulationDAO
The user population DAO -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected I18nizableText
_configureI18nizableText
(Configuration config, I18nizableText defaultValue) Configure an i18nizable textprotected boolean
_initializeValidator
(ThreadSafeComponentManager<Validator> validatorManager, String pluginName, String role, Configuration config) Initialize the validator.void
configure
(Configuration configuration) protected Enumerator
configureEnumerator
(Configuration configuration, ElementDefinition definition) Configure enumerator of the criterionprotected Enumerator
configureEnumerator
(Configuration configuration, ElementDefinition definition, Configuration defaultEnumeratorConfig) Configure enumerator of the criterionprotected void
configureId
(Configuration configuration) Configure the criterion ID.protected void
configureLabelsAndGroup
(Configuration configuration) Configure the labels and group.protected void
configureUIProperties
(Configuration configuration) Configure the standard UI properties (hidden, init class, change class, submit class).protected void
configureValues
(Configuration configuration) Configure the default value.protected String
configureWidget
(Configuration configuration, String defaultWidget, MetadataType type) Configure widget of the criterionprotected String
configureWidget
(Configuration configuration, ElementDefinition definition) Configure widget of the criterionprotected Map<String,
I18nizableText> configureWidgetParameters
(Configuration configuration, Map<String, I18nizableText> defaultParams, MetadataType type, String contentTypeId) Configure widget parameters of the criterionprotected Map<String,
I18nizableText> configureWidgetParameters
(Configuration configuration, ElementDefinition definition) Configure widget parameters of the criterionprotected Map<String,
I18nizableText> configureWidgetParameters
(Configuration configuration, ElementDefinition definition, Configuration defaultWidgetParamsConfig) Configure widget parameters of the criterionvoid
contextualize
(Context context) void
dispose()
Get the JS class name to execute on 'change' eventGet the content type ID (only when the search criteria is of type CONTENT).getFacetLabel
(String value, Locale currentLocale) Get the label of a facet value.getGroup()
Get the group of the search criteriaGet the JS class name to execute on 'init' eventGet theSearchField
representing this search criterion.Get the JS class name to execute on 'submit' eventboolean
isHidden()
Determines if the criteria is hiddenboolean
Determines if the column value is multiplevoid
service
(ServiceManager manager) void
setChangeClassName
(String className) Set the JS class name to execute on 'change' eventvoid
setContentTypeId
(String contentTypeId) Set the content type ID (only when the search criteria is of type CONTENT).void
setGroup
(I18nizableText group) Set the group of the search criteriavoid
setHidden
(boolean hidden) Set the hidden property of the criteriavoid
setInitClassName
(String className) Set the JS class name to execute on 'init' eventvoid
Called at creation time to provide aLogger
.void
setMultiple
(boolean multiple) Set the multiple propertyvoid
setSubmitClassName
(String className) Set the JS class name to execute on 'submit' eventMethods 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.cms.search.model.Field
getEnumerator, getType
Methods inherited from interface org.ametys.cms.search.model.SearchCriterion
getId, getOperator, getQuery, getQuery, isFacetable, isSortable
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUICriterion
getDefaultValue, getDescription, getFieldId, getLabel, getValidator, getWidget, getWidgetParameters
-
Field Details
-
_resolver
The ametys object resolver. -
_cTypeEP
The content type extension point. -
_contentHelper
The content type extension point. -
_userManager
The user manager. -
_userPopulationDAO
The user population DAO -
_enumeratorManager
ComponentManager forEnumerator
s. -
_manager
The service manager -
_logger
the logger -
_context
The avalon context
-
-
Constructor Details
-
AbstractSearchUICriterion
public AbstractSearchUICriterion()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
dispose
- Specified by:
dispose
in interfaceDisposable
-
setLogger
Description copied from interface:LogEnabled
Called at creation time to provide aLogger
.- Specified by:
setLogger
in interfaceLogEnabled
- Parameters:
logger
- aLogger
for messages.
-
configureId
Configure the criterion ID.- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureLabelsAndGroup
Configure the labels and group.- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureValues
Configure the default value.- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureUIProperties
Configure the standard UI properties (hidden, init class, change class, submit class).- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureEnumerator
protected Enumerator configureEnumerator(Configuration configuration, ElementDefinition definition) throws ConfigurationException Configure enumerator of the criterion- Parameters:
configuration
- The search criterion configuration.definition
- The definition of the criterion- Returns:
- the enumerator
- Throws:
ConfigurationException
- if an error occurs
-
configureEnumerator
protected Enumerator configureEnumerator(Configuration configuration, ElementDefinition definition, Configuration defaultEnumeratorConfig) throws ConfigurationException Configure enumerator of the criterion- Parameters:
configuration
- The search criterion configuration.definition
- The definition of the criteriondefaultEnumeratorConfig
- The configuration for property's widget params- Returns:
- the enumerator
- Throws:
ConfigurationException
- if an error occurs
-
configureWidget
Configure widget of the criterion- Parameters:
configuration
- The search criterion configuration.definition
- The definition of the criterion- Returns:
- the widget
-
configureWidget
protected String configureWidget(Configuration configuration, String defaultWidget, MetadataType type) Configure widget of the criterion- Parameters:
configuration
- The search criterion configuration.defaultWidget
- The default widget to use if not present in configuration. IfMetadataType.RICH_TEXT
orMetadataType.MULTILINGUAL_STRING
, it will be forced.type
- the type which must be supported by the widget- Returns:
- the widget
-
configureWidgetParameters
protected Map<String,I18nizableText> configureWidgetParameters(Configuration configuration, Map<String, I18nizableText> defaultParams, MetadataType type, String contentTypeId) throws ConfigurationExceptionConfigure widget parameters of the criterion- Parameters:
configuration
- The search criterion configuration.defaultParams
- The default widget parameters to override with configurationtype
- the type which must be supported by the widget. IfMetadataType.CONTENT
orMetadataType.SUB_CONTENT
, some parameters will be forced.contentTypeId
- ForMetadataType.CONTENT
orMetadataType.SUB_CONTENT
types only. The id of the content type.- Returns:
- the widget parameters
- Throws:
ConfigurationException
- If an error occurs.
-
configureWidgetParameters
protected Map<String,I18nizableText> configureWidgetParameters(Configuration configuration, ElementDefinition definition) throws ConfigurationException Configure widget parameters of the criterion- Parameters:
configuration
- The search criterion configuration.definition
- The definition of the criterion's element- Returns:
- the widget parameters
- Throws:
ConfigurationException
- If an error occurs.
-
configureWidgetParameters
protected Map<String,I18nizableText> configureWidgetParameters(Configuration configuration, ElementDefinition definition, Configuration defaultWidgetParamsConfig) throws ConfigurationException Configure widget parameters of the criterion- Parameters:
configuration
- The search criterion configuration.definition
- The definition of the criterion's elementdefaultWidgetParamsConfig
- The configuration for property's widget params- Returns:
- the widget parameters
- Throws:
ConfigurationException
- If an error occurs.
-
getInitClassName
Get the JS class name to execute on 'init' event- Specified by:
getInitClassName
in interfaceSearchUICriterion
- Returns:
- the JS class name to execute on 'init' event
-
setInitClassName
Set the JS class name to execute on 'init' event- Parameters:
className
- the JS class name
-
getSubmitClassName
Get the JS class name to execute on 'submit' event- Specified by:
getSubmitClassName
in interfaceSearchUICriterion
- Returns:
- the JS class name to execute on 'submit' event
-
setSubmitClassName
Set the JS class name to execute on 'submit' event- Parameters:
className
- the JS class name
-
getChangeClassName
Get the JS class name to execute on 'change' event- Specified by:
getChangeClassName
in interfaceSearchUICriterion
- Returns:
- the JS class name to execute on 'change' event
-
setChangeClassName
Set the JS class name to execute on 'change' event- Parameters:
className
- the JS class name
-
getGroup
Get the group of the search criteria- Specified by:
getGroup
in interfaceSearchUICriterion
- Returns:
null
if the search criteria does not belong to any group, the name of the group otherwise
-
setGroup
Set the group of the search criteria- Parameters:
group
- the group this search criteria will be added to
-
isHidden
Determines if the criteria is hidden- Specified by:
isHidden
in interfaceSearchUICriterion
- Returns:
true
if the criteria is hidden
-
setHidden
Set the hidden property of the criteria- Parameters:
hidden
- true to hide the search criteria
-
setMultiple
Set the multiple property- Parameters:
multiple
- the multiple property
-
isMultiple
Determines if the column value is multiple- Specified by:
isMultiple
in interfaceField
- Returns:
true
if the value is multiple
-
getContentTypeId
Get the content type ID (only when the search criteria is of type CONTENT).- Specified by:
getContentTypeId
in interfaceField
- Returns:
- the content type ID.
-
setContentTypeId
Set the content type ID (only when the search criteria is of type CONTENT).- Parameters:
contentTypeId
- the content type ID.
-
getFacetLabel
Description copied from interface:SearchUICriterion
Get the label of a facet value.- Specified by:
getFacetLabel
in interfaceSearchUICriterion
- Parameters:
value
- the facet value.currentLocale
- the current locale- Returns:
- the label, or null if the value does not exist.
-
getSearchField
Description copied from interface:SearchCriterion
Get theSearchField
representing this search criterion.- Specified by:
getSearchField
in interfaceSearchCriterion
- Returns:
- the
SearchField
representing this search criterion.
-
_initializeValidator
protected boolean _initializeValidator(ThreadSafeComponentManager<Validator> validatorManager, String pluginName, String role, Configuration config) throws ConfigurationException Initialize the validator.- Parameters:
validatorManager
- The validator manager.pluginName
- The plugin name.role
- The validator role.config
- The validator configuration.- Returns:
- true if the validator was successfully added, false otherwise.
- Throws:
ConfigurationException
- If an error occurs.
-
_configureI18nizableText
protected I18nizableText _configureI18nizableText(Configuration config, I18nizableText defaultValue) Configure an i18nizable text- Parameters:
config
- The Configuration.defaultValue
- The default value as an I18nizableText.- Returns:
- The i18nizable text
-