Package org.ametys.cms.search.model.impl
Class AbstractCriterionDefinition<T>
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
org.ametys.runtime.model.DefaultElementDefinition<T>
org.ametys.cms.search.model.impl.AbstractCriterionDefinition<T>
- Type Parameters:
T- Type of the criterion value
- All Implemented Interfaces:
Comparable<ModelItem>,CriterionDefinition<T>,ElementDefinition<T>,ModelItem,Labelable,ModifiableLabelable
- Direct Known Subclasses:
AbstractSearchServiceCriterionDefinition,DefaultSearchModelCriterionDefinition,ReferencingCriterionDefinition
public abstract class AbstractCriterionDefinition<T>
extends DefaultElementDefinition<T>
implements CriterionDefinition<T>
Abstract implementation for
CriterionDefinition-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CriterionDefinitionHelperThe criterion definition helperThe criterion's joined pathsprotected Query.LogicalOperatorLogical operator to use for multi-valued criteriaprotected StringThe criterion's solr facet field nameFields inherited from class org.ametys.runtime.model.DefaultElementDefinition
_loggerFields inherited from class org.ametys.runtime.model.AbstractModelItem
__context, __serviceManagerFields inherited from interface org.ametys.runtime.model.ElementDefinition
CONFIG_DEFAULT_VALUE_TYPEFields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CriterionDefinitionHelperRetrieves theCriterionDefinitionHelperprotected StringRetrieves the default widget for the criterionprotected Map<String, I18nizableText> Retrieves the default widget parameters for the criterionconvertQueryValue(Object value, Map<String, Object> contextualParameters) Converts the given value to have the right typed for value to give to theCriterionDefinition.getQuery(Object, Map, String, Map)methodgetJoinedPaths(Map<String, Object> contextualParameters) Retrieves the joined paths of the criterionprotected Query.LogicalOperatorRetrieves the logical operator for multi-valued criteriagetQuery(Object value, Query.Operator operator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Get theQueryassociated to the given value.protected CMSDataContextgetQueryContext(String language, Map<String, Object> contextualParameters) Retrieves the context to use in querygetSolrFacetFieldName(Map<String, Object> contextualParameters) Retrieves the name of the criterion's solr facet fieldgetType()Retrieves the type.Retrieves the widget to use for rendering.Get the widget's parametersvoidsetJoinedPaths(List<String> joinedPath) Set the criterion's joined pathsvoidsetSolrFacetFieldName(String solrFacetFieldName) Set the criterion's solr facet field nameMethods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_defaultValueToJSON, _getDefaultValues, _getSimpleDefaultValue, _toJSON, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isMultiple, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration, setWidget, setWidgetParameters, toSAXMethods inherited from class org.ametys.runtime.model.AbstractModelItem
_getModelItemHelper, _shouldJSONBeEmpty, _widgetParameterToSAX, addItemChecker, compareTo, disableConditionsToJSON, equals, getDescription, getDisableConditions, getItemCheckers, getLabel, getModel, getName, getParent, getPath, getPluginName, hashCode, setContext, setDescription, setDisableConditions, setLabel, setModel, setName, setParent, setPluginName, setServiceManager, toJSON, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.ametys.cms.search.model.CriterionDefinition
getQuery, getQueryMethods inherited from interface org.ametys.runtime.model.ElementDefinition
getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumerator, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isEditable, isMultiple, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setValidator, setValidatorConfigurationMethods inherited from interface org.ametys.runtime.util.Labelable
getDescription, getLabel, getNameMethods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, setDisableConditions, setModel, setParent, setPluginName, setType, setWidget, setWidgetParameters, toJSON, toSAXMethods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
-
Field Details
-
_criterionDefinitionHelper
The criterion definition helper -
_multipleOperandOperator
Logical operator to use for multi-valued criteria -
_solrFacetFieldName
The criterion's solr facet field name -
_joinedPaths
The criterion's joined paths
-
-
Constructor Details
-
AbstractCriterionDefinition
public AbstractCriterionDefinition()
-
-
Method Details
-
getMultipleOperandOperator
Retrieves the logical operator for multi-valued criteria- Returns:
- the the logical operator for multi-valued criteria
-
getQuery
public Query getQuery(Object value, Query.Operator operator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Description copied from interface:CriterionDefinitionGet theQueryassociated to the given value.- Specified by:
getQueryin interfaceCriterionDefinition<T>- Parameters:
value- The user-submitted value (or the default value if not set) for this criterion.operator- In advanced search mode, the operator chosen by the user.nullto use the criterion-defined operator (simple search mode).allValues- All the user-submitted values.language- The current search language.contextualParameters- the search contextual parameters.- Returns:
Queryassociated to the given value.
-
convertQueryValue
Description copied from interface:CriterionDefinitionConverts the given value to have the right typed for value to give to theCriterionDefinition.getQuery(Object, Map, String, Map)method- Specified by:
convertQueryValuein interfaceCriterionDefinition<T>- Parameters:
value- the value to convertcontextualParameters- the search contextual parameters.- Returns:
- the value, converted to a well typed value
-
getQueryContext
Retrieves the context to use in query- Parameters:
language- The current search language.contextualParameters- the search contextual parameters.- Returns:
- the context to use in query
-
getSolrFacetFieldName
Description copied from interface:CriterionDefinitionRetrieves the name of the criterion's solr facet field- Specified by:
getSolrFacetFieldNamein interfaceCriterionDefinition<T>- Parameters:
contextualParameters- the search contextual parameters.- Returns:
- the name of the criterion's solr facet field. Can be
nullif the criterion is not facetable
-
setSolrFacetFieldName
Set the criterion's solr facet field name- Parameters:
solrFacetFieldName- the solr facet field name to set
-
getJoinedPaths
Description copied from interface:CriterionDefinitionRetrieves the joined paths of the criterion- Specified by:
getJoinedPathsin interfaceCriterionDefinition<T>- Parameters:
contextualParameters- the search contextual parameters.- Returns:
- the joined paths, or an empty list if the criterion is not joined
-
setJoinedPaths
Set the criterion's joined paths- Parameters:
joinedPath- the joined paths to set
-
getWidget
Description copied from interface:ModelItemRetrieves the widget to use for rendering.- Specified by:
getWidgetin interfaceModelItem- Overrides:
getWidgetin classDefaultElementDefinition<T>- Returns:
- the widget or
nullif none is defined.
-
_getDefaultWidget
Retrieves the default widget for the criterion- Returns:
- the default widget for the criterion
-
getWidgetParameters
Description copied from interface:ModelItemGet the widget's parameters- Specified by:
getWidgetParametersin interfaceModelItem- Overrides:
getWidgetParametersin classDefaultElementDefinition<T>- Returns:
- the widget's parameters
-
_getDefaultWidgetParameters
Retrieves the default widget parameters for the criterion- Returns:
- the default widget parameters for the criterion
-
getType
Description copied from interface:ModelItemRetrieves the type.- Specified by:
getTypein interfaceCriterionDefinition<T>- Specified by:
getTypein interfaceElementDefinition<T>- Specified by:
getTypein interfaceModelItem- Overrides:
getTypein classDefaultElementDefinition<T>- Returns:
- the type.
-
_getCriterionDefinitionHelper
Retrieves theCriterionDefinitionHelper- Returns:
- the
CriterionDefinitionHelper
-