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 ContentSearchHelperThe content search helperprotected ContentTypeExtensionPointThe content type extension pointThe identifiers of the content types defining the referenceprotected ModelItemTypeExtensionPointThe extension point containing all available criterion typesprotected ElementDefinitionThe referenced definition used for this criterionprotected StringThe path of the field from the containing search modelstatic final StringNone value to search for reference where the attribute does not existFields inherited from class org.ametys.cms.search.model.impl.AbstractCriterionDefinition
_criterionDefinitionHelper, _joinedPaths, _multipleOperandOperator, _solrFacetFieldNameFields 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
ConstructorsConstructorDescriptionDefault constructor.ReferencingCriterionDefinition(ElementDefinition reference, String referencePath) Constructor used to create a BO criterion definition on a referenced item -
Method Summary
Modifier and TypeMethodDescriptionprotected ContentSearchHelperRetrieves the content search helperprotected ContentTypeExtensionPointRetrieves The content type extension pointprotected ModelItemTypeExtensionPointRetrieves The extension point containing all available criterion typesprotected Enumerator<T> Retrieves the defaultEnumeratorfor the current criterion definitionprotected StringRetrieves the default widget for the criterionprotected Map<String, I18nizableText> Retrieves the default widget parameters for the criterionprotected StringRetrieves the suffix of the facet field nameprotected ConfigurationRetrieves the root criterion configuration Used to wrap it for enumerator and widget parametersprotected booleanDetermine 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 theQueryassociated 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.voidsetContentTypeIds(Set<String> contentTypeIds) Set the identifiers of the content types defining the referenceprotected voidsetReference(ElementDefinition<T> reference) Set the referenced element definitionprotected voidsetReferencePath(String referencePath) Set the path of the criterion's referenceMethods inherited from class org.ametys.cms.search.model.impl.AbstractCriterionDefinition
_getCriterionDefinitionHelper, getMultipleOperandOperator, getQueryContext, getWidget, getWidgetParameters, setJoinedPaths, setSolrFacetFieldNameMethods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_defaultValueToJSON, _getDefaultValues, _getSimpleDefaultValue, _toJSON, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, 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, getDisableConditions, getItemCheckers, 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, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isEditable, isMultiple, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setValidator, setValidatorConfigurationMethods 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
-
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:LabelableRetrieves the label.- Specified by:
getLabelin interfaceLabelable- Overrides:
getLabelin classAbstractModelItem- Returns:
- the label.
-
getDescription
Description copied from interface:LabelableRetrieves the description.- Specified by:
getDescriptionin interfaceLabelable- Overrides:
getDescriptionin classAbstractModelItem- Returns:
- the description.
-
getType
Description copied from interface:ModelItemRetrieves the type.- Specified by:
getTypein interfaceCriterionDefinition<T>- Specified by:
getTypein interfaceElementDefinition<T>- Specified by:
getTypein interfaceModelItem- Overrides:
getTypein classAbstractCriterionDefinition<T>- Returns:
- the type.
-
_getDefaultWidget
Description copied from class:AbstractCriterionDefinitionRetrieves the default widget for the criterion- Overrides:
_getDefaultWidgetin classAbstractCriterionDefinition<T>- Returns:
- the default widget for the criterion
-
_getDefaultWidgetParameters
Description copied from class:AbstractCriterionDefinitionRetrieves the default widget parameters for the criterion- Overrides:
_getDefaultWidgetParametersin classAbstractCriterionDefinition<T>- Returns:
- the default widget parameters for the criterion
-
getEnumerator
Description copied from interface:ElementDefinitionRetrieves the enumerator.- Specified by:
getEnumeratorin interfaceElementDefinition<T>- Overrides:
getEnumeratorin classDefaultElementDefinition<T>- Returns:
- the enumerator or
nullif none is defined.
-
_getDefaultEnumerator
Retrieves the defaultEnumeratorfor the current criterion definition- Returns:
- the default
Enumeratorfor 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: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>- Overrides:
convertQueryValuein 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:CriterionDefinitionGet theQueryassociated to the given value.- Specified by:
getQueryin interfaceCriterionDefinition<T>- Overrides:
getQueryin 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.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.
-
getSolrFacetFieldName
Description copied from interface:CriterionDefinitionRetrieves the name of the criterion's solr facet field- Specified by:
getSolrFacetFieldNamein interfaceCriterionDefinition<T>- Overrides:
getSolrFacetFieldNamein classAbstractCriterionDefinition<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
-
_isFacetable
Determine if the current criterion definition can be used as facet- Returns:
trueif the current criterion definition can be used as facet,falseotherwise
-
_getFacetFieldNameSuffix
Retrieves the suffix of the facet field name- Returns:
- the suffix of the facet field name
-
getJoinedPaths
Description copied from interface:CriterionDefinitionRetrieves the joined paths of the criterion- Specified by:
getJoinedPathsin interfaceCriterionDefinition<T>- Overrides:
getJoinedPathsin 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
-