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_contentHelperThe content type extension point.protected ContentTypeExtensionPoint_cTypeEPThe content type extension point.protected AmetysObjectResolver_resolverThe ametys object resolver.protected UserManager_userManagerThe user manager.protected UserPopulationDAO_userPopulationDAOThe 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.voidconfigure(Configuration configuration)protected 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 Map<String,I18nizableText>configureWidgetParameters(Configuration configuration, Map<String,I18nizableText> defaultParams, MetadataType type, String contentTypeId)Configure widget parameters of the criterionStringgetChangeClassName()Get the JS class name to execute on 'change' eventStringgetContentTypeId()Get the content type ID (only when the search criteria is of type CONTENT).I18nizableTextgetFacetLabel(String value, Locale currentLocale)Get the label of a facet value.I18nizableTextgetGroup()Get the group of the search criteriaStringgetInitClassName()Get the JS class name to execute on 'init' eventprotected MetadataDefinitiongetMetadataDefinition(MetadataIndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths, boolean addLast)Get the metadata definition from the indexing field and compute the join paths.SearchFieldgetSearchField()Get theSearchFieldrepresenting this search criterion.StringgetSubmitClassName()Get the JS class name to execute on 'submit' eventbooleanisHidden()Determines if the criteria is hiddenbooleanisMultiple()Determines 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' eventvoidsetMultiple(boolean multiple)Set the multiple propertyvoidsetSubmitClassName(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
-
-
Constructor Detail
-
AbstractSearchUICriterion
public AbstractSearchUICriterion()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein 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_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 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.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.
-
getInitClassName
public String 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
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:
getSubmitClassNamein 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:
getChangeClassNamein 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:
getGroupin interfaceSearchUICriterion- Returns:
nullif 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:
isHiddenin interfaceSearchUICriterion- Returns:
trueif 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:
isMultiplein interfaceField- Returns:
trueif the value is multiple
-
getContentTypeId
public String 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
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: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
public SearchField 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
-
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-trueto add the last join path element to the list,falseotherwise.- Returns:
- The metadata definition or null if not found
- Throws:
ConfigurationException- If an error occurs.
-
-