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 aSearchUIModel
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentHelper
_contentHelper
The content type extension point.private String
_contentTypeId
protected ContentTypeExtensionPoint
_cTypeEP
The content type extension point.private I18nizableText
_group
private boolean
_hidden
private boolean
_multiple
private String
_onChangeClassName
private String
_onInitClassName
private String
_onSubmitClassName
protected AmetysObjectResolver
_resolver
The ametys object resolver.protected UserManager
_userManager
The user manager.protected UserPopulationDAO
_userPopulationDAO
The user population DAO
-
Constructor Summary
Constructors Constructor Description AbstractSearchUICriterion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 criterionString
getChangeClassName()
Get the JS class name to execute on 'change' eventString
getContentTypeId()
Get the content type ID (only when the search criteria is of type CONTENT).I18nizableText
getFacetLabel(String value, Locale currentLocale)
Get the label of a facet value.I18nizableText
getGroup()
Get the group of the search criteriaString
getInitClassName()
Get 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.SearchField
getSearchField()
Get theSearchField
representing this search criterion.String
getSubmitClassName()
Get the JS class name to execute on 'submit' eventboolean
isHidden()
Determines if the criteria is hiddenboolean
isMultiple()
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' event-
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.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 Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver.
-
_cTypeEP
protected ContentTypeExtensionPoint _cTypeEP
The content type extension point.
-
_contentHelper
protected ContentHelper _contentHelper
The content type extension point.
-
_userManager
protected UserManager _userManager
The user manager.
-
_userPopulationDAO
protected UserPopulationDAO _userPopulationDAO
The user population DAO
-
_onInitClassName
private String _onInitClassName
-
_onSubmitClassName
private String _onSubmitClassName
-
_onChangeClassName
private String _onChangeClassName
-
_hidden
private boolean _hidden
-
_multiple
private boolean _multiple
-
_group
private I18nizableText _group
-
_contentTypeId
private String _contentTypeId
-
-
Constructor Detail
-
AbstractSearchUICriterion
public AbstractSearchUICriterion()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
configureId
protected void configureId(Configuration configuration) throws ConfigurationException
Configure the criterion ID.- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureLabelsAndGroup
protected void configureLabelsAndGroup(Configuration configuration) throws ConfigurationException
Configure the labels and group.- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureValues
protected void configureValues(Configuration configuration) throws ConfigurationException
Configure the default value.- Parameters:
configuration
- The search criterion configuration.- Throws:
ConfigurationException
- If an error occurs.
-
configureUIProperties
protected void configureUIProperties(Configuration configuration) throws ConfigurationException
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 ConfigurationException
Configure 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
public String 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
public void setInitClassName(String className)
Set the JS class name to execute on 'init' event- Parameters:
className
- the JS class name
-
getSubmitClassName
public String 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
public void setSubmitClassName(String className)
Set the JS class name to execute on 'submit' event- Parameters:
className
- the JS class name
-
getChangeClassName
public String 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
public void setChangeClassName(String className)
Set the JS class name to execute on 'change' event- Parameters:
className
- the JS class name
-
getGroup
public I18nizableText 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
public void setGroup(I18nizableText group)
Set the group of the search criteria- Parameters:
group
- the group this search criteria will be added to
-
isHidden
public boolean isHidden()
Determines if the criteria is hidden- Specified by:
isHidden
in interfaceSearchUICriterion
- Returns:
true
if the criteria is hidden
-
setHidden
public void setHidden(boolean hidden)
Set the hidden property of the criteria- Parameters:
hidden
- true to hide the search criteria
-
setMultiple
public void setMultiple(boolean multiple)
Set the multiple property- Parameters:
multiple
- the multiple property
-
isMultiple
public boolean isMultiple()
Determines if the column value is multiple- Specified by:
isMultiple
in interfaceField
- Returns:
true
if the value is multiple
-
getContentTypeId
public String 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
public void setContentTypeId(String contentTypeId)
Set the content type ID (only when the search criteria is of type CONTENT).- Parameters:
contentTypeId
- the content type ID.
-
getFacetLabel
public I18nizableText getFacetLabel(String value, Locale currentLocale)
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
public SearchField 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.
-
-