Package org.ametys.cms.search.model.impl
Class ReferencingCriterionDefinition<T>
java.lang.Object
org.ametys.runtime.model.AbstractModelItem
org.ametys.runtime.model.DefaultElementDefinition<T>
org.ametys.cms.search.model.impl.AbstractCriterionDefinition<T>
org.ametys.cms.search.model.impl.ReferencingCriterionDefinition<T>
- Type Parameters:
T
- Type of the criterion value
- All Implemented Interfaces:
Comparable<ModelItem>
,CriterionDefinition<T>
,ElementDefinition<T>
,ModelItem
,Labelable
,ModifiableLabelable
- Direct Known Subclasses:
ReferencingSearchModelCriterionDefinition
,ReferencingSearchServiceCriterionDefinition
Default implementation for
CriterionDefinition
searching on a model item.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentSearchHelper
The content search helperprotected ContentTypeExtensionPoint
The content type extension pointThe identifiers of the content types defining the referenceprotected ModelItemTypeExtensionPoint
The extension point containing all available criterion typesprotected ElementDefinition
The referenced definition used for this criterionprotected String
The path of the field from the containing search modelstatic final String
None value to search for reference where the attribute does not existFields inherited from class org.ametys.cms.search.model.impl.AbstractCriterionDefinition
_criterionDefinitionHelper, _joinedPaths, _multipleOperandOperator, _solrFacetFieldName
Fields inherited from class org.ametys.runtime.model.DefaultElementDefinition
_logger
Fields inherited from class org.ametys.runtime.model.AbstractModelItem
__context, __serviceManager
Fields inherited from interface org.ametys.runtime.model.ElementDefinition
CONFIG_DEFAULT_VALUE_TYPE
Fields inherited from interface org.ametys.runtime.model.ModelItem
ITEM_PATH_SEPARATOR
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ReferencingCriterionDefinition
(ElementDefinition reference, String referencePath) Constructor used to create a BO criterion definition on a referenced item -
Method Summary
Modifier and TypeMethodDescriptionprotected ContentSearchHelper
Retrieves the content search helperprotected ContentTypeExtensionPoint
Retrieves The content type extension pointprotected ModelItemTypeExtensionPoint
Retrieves The extension point containing all available criterion typesprotected Enumerator
<T> Retrieves the defaultEnumerator
for the current criterion definitionprotected String
Retrieves the default widget for the criterionprotected Map
<String, I18nizableText> Retrieves the default widget parameters for the criterionprotected String
Retrieves the suffix of the facet field nameprotected Configuration
Retrieves the root criterion configuration Used to wrap it for enumerator and widget parametersprotected boolean
Determine if the current criterion definition can be used as facetconvertQueryValue
(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)
methodgetContentTypeIds
(Map<String, Object> contextualParameters) Retrieves the identifiers of the content types defining the referenceRetrieves the description.Retrieves the enumerator.getJoinedPaths
(Map<String, Object> contextualParameters) Retrieves the joined paths of the criteriongetLabel()
Retrieves the label.getQuery
(Object value, Query.Operator operator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Get theQuery
associated to the given value.Retrieves the referenced element definitionGet the path in the criterion's reference.getSolrFacetFieldName
(Map<String, Object> contextualParameters) Retrieves the name of the criterion's solr facet fieldgetType()
Retrieves the type.void
setContentTypeIds
(Set<String> contentTypeIds) Set the identifiers of the content types defining the referenceprotected void
setReference
(ElementDefinition<T> reference) Set the referenced element definitionprotected void
setReferencePath
(String referencePath) Set the path of the criterion's referenceMethods inherited from class org.ametys.cms.search.model.impl.AbstractCriterionDefinition
_defaultValueToJSON, _getCriterionDefinitionHelper, getMultipleOperandOperator, getQueryContext, getWidget, getWidgetParameters, setJoinedPaths, setSolrFacetFieldName
Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_getDefaultValues, _toJSON, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isMultiple, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration, setWidget, setWidgetParameters, toSAX
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_getModelItemHelper, _shouldJSONBeEmpty, _widgetParameterToSAX, addItemChecker, compareTo, disableConditionsToJSON, equals, getDisableConditions, getItemCheckers, getModel, getName, getParent, getPath, getPluginName, hashCode, setContext, setDescription, setDisableConditions, setLabel, setModel, setName, setParent, setPluginName, setServiceManager, toJSON, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.ametys.cms.search.model.CriterionDefinition
getQuery, getQuery
Methods inherited from interface org.ametys.runtime.model.ElementDefinition
getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isEditable, isMultiple, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setValidator, setValidatorConfiguration
Methods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getModel, getParent, getPath, getPluginName, setDisableConditions, setModel, setParent, setPluginName, setType, setWidget, setWidgetParameters, toJSON, toSAX
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
-
Field Details
-
NONE_VALUE
None value to search for reference where the attribute does not exist- See Also:
-
_contentTypeExtensionPoint
The content type extension point -
_criterionTypeExtensionPoint
The extension point containing all available criterion types -
_contentSearchHelper
The content search helper -
_reference
The referenced definition used for this criterion -
_referencePath
The path of the field from the containing search model -
_contentTypeIds
The identifiers of the content types defining the reference
-
-
Constructor Details
-
ReferencingCriterionDefinition
public ReferencingCriterionDefinition()Default constructor. -
ReferencingCriterionDefinition
Constructor used to create a BO criterion definition on a referenced item- Parameters:
reference
- the item referenced by this criterionreferencePath
- the path of the criterion's reference
-
-
Method Details
-
getReferencePath
Get the path in the criterion's reference.- Returns:
- the path in the criterion's reference.
-
setReferencePath
Set the path of the criterion's reference- Parameters:
referencePath
- the reference path to set
-
getReference
Retrieves the referenced element definition- Returns:
- the referenced element definition
-
setReference
Set the referenced element definition- Parameters:
reference
- the referenced element definition to set
-
getContentTypeIds
Retrieves the identifiers of the content types defining the reference- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the identifiers of the content types defining the reference
-
setContentTypeIds
Set the identifiers of the content types defining the reference- Parameters:
contentTypeIds
- the content type identifiers to set
-
getLabel
Description copied from interface:Labelable
Retrieves the label.- Specified by:
getLabel
in interfaceLabelable
- Overrides:
getLabel
in classAbstractModelItem
- Returns:
- the label.
-
getDescription
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Overrides:
getDescription
in classAbstractModelItem
- Returns:
- the description.
-
getType
Description copied from interface:ModelItem
Retrieves the type.- Specified by:
getType
in interfaceCriterionDefinition<T>
- Specified by:
getType
in interfaceElementDefinition<T>
- Specified by:
getType
in interfaceModelItem
- Overrides:
getType
in classAbstractCriterionDefinition<T>
- Returns:
- the type.
-
_getDefaultWidget
Description copied from class:AbstractCriterionDefinition
Retrieves the default widget for the criterion- Overrides:
_getDefaultWidget
in classAbstractCriterionDefinition<T>
- Returns:
- the default widget for the criterion
-
_getDefaultWidgetParameters
Description copied from class:AbstractCriterionDefinition
Retrieves the default widget parameters for the criterion- Overrides:
_getDefaultWidgetParameters
in classAbstractCriterionDefinition<T>
- Returns:
- the default widget parameters for the criterion
-
getEnumerator
Description copied from interface:ElementDefinition
Retrieves the enumerator.- Specified by:
getEnumerator
in interfaceElementDefinition<T>
- Overrides:
getEnumerator
in classDefaultElementDefinition<T>
- Returns:
- the enumerator or
null
if none is defined.
-
_getDefaultEnumerator
Retrieves the defaultEnumerator
for the current criterion definition- Returns:
- the default
Enumerator
for the current criterion definition
-
_getRootCriterionConfiguration
Retrieves the root criterion configuration Used to wrap it for enumerator and widget parameters- Returns:
- the root criterion configuration
-
convertQueryValue
Description copied from interface:CriterionDefinition
Converts the given value to have the right typed for value to give to theCriterionDefinition.getQuery(Object, Map, String, Map)
method- Specified by:
convertQueryValue
in interfaceCriterionDefinition<T>
- Overrides:
convertQueryValue
in classAbstractCriterionDefinition<T>
- Parameters:
value
- the value to convertcontextualParameters
- the search contextual parameters.- Returns:
- the value, converted to a well typed value
-
getQuery
public Query getQuery(Object value, Query.Operator operator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Description copied from interface:CriterionDefinition
Get theQuery
associated to the given value.- Specified by:
getQuery
in interfaceCriterionDefinition<T>
- Overrides:
getQuery
in classAbstractCriterionDefinition<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.null
to 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:
Query
associated to the given value.
-
getSolrFacetFieldName
Description copied from interface:CriterionDefinition
Retrieves the name of the criterion's solr facet field- Specified by:
getSolrFacetFieldName
in interfaceCriterionDefinition<T>
- Overrides:
getSolrFacetFieldName
in classAbstractCriterionDefinition<T>
- Parameters:
contextualParameters
- the search contextual parameters.- Returns:
- the name of the criterion's solr facet field. Can be
null
if the criterion is not facetable
-
_isFacetable
Determine if the current criterion definition can be used as facet- Returns:
true
if the current criterion definition can be used as facet,false
otherwise
-
_getFacetFieldNameSuffix
Retrieves the suffix of the facet field name- Returns:
- the suffix of the facet field name
-
getJoinedPaths
Description copied from interface:CriterionDefinition
Retrieves the joined paths of the criterion- Specified by:
getJoinedPaths
in interfaceCriterionDefinition<T>
- Overrides:
getJoinedPaths
in classAbstractCriterionDefinition<T>
- Parameters:
contextualParameters
- the search contextual parameters.- Returns:
- the joined paths, or an empty list if the criterion is not joined
-
_getContentTypeExtensionPoint
Retrieves The content type extension point- Returns:
- The content type extension point
-
_getCriterionTypeExtensionPoint
Retrieves The extension point containing all available criterion types- Returns:
- The extension point containing all available criterion types
-
_getContentSearchHelper
Retrieves the content search helper- Returns:
- the content search helper
-