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
,Configurable
,Serviceable
- Direct Known Subclasses:
AbstractCustomSearchUICriterion
,DynamicWrappedSearchUIModel.WrappedSearchUICriterion
,IndexingFieldAggregatorSearchUICriterion
,IndexingFieldSearchUICriterion
,SystemSearchUICriterion
public abstract class AbstractSearchUICriterion
extends Parameter<MetadataType>
implements SearchUICriterion, Serviceable, Configurable
This class represents a search criterion of a
SearchUIModel
.-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentHelper
The content type extension point.protected ContentTypeExtensionPoint
The content type extension point.protected 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 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 Map<String,
I18nizableText> configureWidgetParameters
(Configuration configuration, Map<String, I18nizableText> defaultParams, MetadataType type, String contentTypeId) Configure widget parameters of the criterionGet 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' eventprotected MetadataDefinition
getMetadataDefinition
(MetadataIndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths, boolean addLast) Get the metadata definition from the indexing field and compute the join paths.Get 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
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
-
-
Constructor Details
-
AbstractSearchUICriterion
public AbstractSearchUICriterion()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
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.
-
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.
-
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
-
getMetadataDefinition
protected MetadataDefinition getMetadataDefinition(MetadataIndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths, boolean addLast) throws ConfigurationException Get the metadata definition from the indexing field and compute the join paths. Can be null if the last indexing field is a custom indexing field.- Parameters:
indexingField
- The initial indexing fieldremainingPathSegments
- The path to access the metadata or an another indexing field from the initial indexing fieldjoinPaths
- The consecutive's path in case of joint to access the field/metadataaddLast
-true
to add the last join path element to the list,false
otherwise.- Returns:
- The metadata definition or null if not found
- Throws:
ConfigurationException
- If an error occurs.
-