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
FieldsModifier and TypeFieldDescriptionprotected ContentHelperThe content type extension point.protected ContextThe avalon contextprotected ContentTypeExtensionPointThe content type extension point.protected ThreadSafeComponentManager<Enumerator>ComponentManager forEnumerators.protected Loggerthe loggerprotected ServiceManagerThe service managerprotected AmetysObjectResolverThe ametys object resolver.protected UserManagerThe user manager.protected UserPopulationDAOThe user population DAO -
Constructor Summary
Constructors -
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.voidconfigure(Configuration configuration) protected EnumeratorconfigureEnumerator(Configuration configuration, ElementDefinition definition) Configure enumerator of the criterionprotected EnumeratorconfigureEnumerator(Configuration configuration, ElementDefinition definition, Configuration defaultEnumeratorConfig) Configure enumerator of the criterionprotected voidconfigureId(Configuration configuration) Configure the criterion ID.protected voidconfigureLabelsAndGroup(Configuration configuration) Configure the labels and group.protected voidconfigureUIProperties(Configuration configuration) Configure the standard UI properties (hidden, init class, change class, submit class).protected voidconfigureValues(Configuration configuration) Configure the default value.protected StringconfigureWidget(Configuration configuration, String defaultWidget, MetadataType type) Configure widget of the criterionprotected StringconfigureWidget(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 criterionvoidcontextualize(Context context) voiddispose()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 theSearchFieldrepresenting this search criterion.Get the JS class name to execute on 'submit' eventbooleanisHidden()Determines if the criteria is hiddenbooleanDetermines if the column value is multiplevoidservice(ServiceManager manager) voidsetChangeClassName(String className) Set the JS class name to execute on 'change' eventvoidsetContentTypeId(String contentTypeId) Set the content type ID (only when the search criteria is of type CONTENT).voidsetGroup(I18nizableText group) Set the group of the search criteriavoidsetHidden(boolean hidden) Set the hidden property of the criteriavoidsetInitClassName(String className) Set the JS class name to execute on 'init' eventvoidCalled at creation time to provide aLogger.voidsetMultiple(boolean multiple) Set the multiple propertyvoidsetSubmitClassName(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, setWidgetParametersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.cms.search.model.Field
getEnumerator, getTypeMethods inherited from interface org.ametys.cms.search.model.SearchCriterion
getId, getOperator, getQuery, getQuery, isFacetable, isSortableMethods 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 forEnumerators. -
_manager
The service manager -
_logger
the logger -
_context
The avalon context
-
-
Constructor Details
-
AbstractSearchUICriterion
public AbstractSearchUICriterion()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
dispose
- Specified by:
disposein interfaceDisposable
-
setLogger
Description copied from interface:LogEnabledCalled at creation time to provide aLogger.- Specified by:
setLoggerin interfaceLogEnabled- Parameters:
logger- aLoggerfor 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_TEXTorMetadataType.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.CONTENTorMetadataType.SUB_CONTENT, some parameters will be forced.contentTypeId- ForMetadataType.CONTENTorMetadataType.SUB_CONTENTtypes 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:
getInitClassNamein 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:
getSubmitClassNamein 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:
getChangeClassNamein 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:
getGroupin interfaceSearchUICriterion- Returns:
nullif 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:
isHiddenin interfaceSearchUICriterion- Returns:
trueif 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:
isMultiplein interfaceField- Returns:
trueif the value is multiple
-
getContentTypeId
Get the content type ID (only when the search criteria is of type CONTENT).- Specified by:
getContentTypeIdin 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:SearchUICriterionGet the label of a facet value.- Specified by:
getFacetLabelin 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:SearchCriterionGet theSearchFieldrepresenting this search criterion.- Specified by:
getSearchFieldin interfaceSearchCriterion- Returns:
- the
SearchFieldrepresenting 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
-