Package org.ametys.cms.search.model.impl
Class ReferencingSearchModelCriterionDefinition<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>
org.ametys.cms.search.model.impl.ReferencingSearchModelCriterionDefinition<T>
- Type Parameters:
T
- Type of the criterion value
- All Implemented Interfaces:
Comparable<ModelItem>
,CriterionDefinition<T>
,SearchModelCriterionDefinition<T>
,ElementDefinition<T>
,ModelItem
,Labelable
,ModifiableLabelable
- Direct Known Subclasses:
ContentReferencingSearchModelCriterionDefinition
,ContentTypesAwareReferencingCriterionDefinition
,LanguageAwareReferencingCriterionDefinition
,StaticReferencingSearchModelCriterionDefinition
public class ReferencingSearchModelCriterionDefinition<T>
extends ReferencingCriterionDefinition<T>
implements SearchModelCriterionDefinition<T>
Default implementation for
SearchModelCriterionDefinition
searching on a model item.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Query.Operator
The criteria operatorstatic final String
Prefix for name of referencing criterion definitionsFields inherited from class org.ametys.cms.search.model.impl.ReferencingCriterionDefinition
_contentSearchHelper, _contentTypeExtensionPoint, _contentTypeIds, _criterionTypeExtensionPoint, _reference, _referencePath, NONE_VALUE
Fields 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.ReferencingSearchModelCriterionDefinition
(ElementDefinition reference, String referencePath) Constructor used to create a BO criterion definition on a referenced item -
Method Summary
Modifier and TypeMethodDescriptionprotected Query.Operator
Retrieves the default operator for the criterion_toJSON
(DefinitionContext context) Converts the model item in a JSON mapvoid
Copy the current criterion definition in the given one.getContentTypeIds
(Map<String, Object> contextualParameters) Retrieves the identifiers of the content types defining the referencegetModel()
Retrieves the model of the itemgetName()
Get the name.Get the criterion Operator.getQuery
(Object value, Query.Operator customOperator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Get theQuery
associated to the given value.void
setMultipleOperandOperator
(Query.LogicalOperator multipleOperand) Set the the logical operator for multi-valued criteriavoid
setOperator
(Query.Operator operator) Set the criterion Operator.void
toSAX
(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the model itemMethods inherited from class org.ametys.cms.search.model.impl.ReferencingCriterionDefinition
_getContentSearchHelper, _getContentTypeExtensionPoint, _getCriterionTypeExtensionPoint, _getDefaultEnumerator, _getDefaultWidget, _getDefaultWidgetParameters, _getFacetFieldNameSuffix, _getRootCriterionConfiguration, _isFacetable, convertQueryValue, getDescription, getEnumerator, getJoinedPaths, getLabel, getReference, getReferencePath, getSolrFacetFieldName, getType, setContentTypeIds, setReference, setReferencePath
Methods inherited from class org.ametys.cms.search.model.impl.AbstractCriterionDefinition
_getCriterionDefinitionHelper, getMultipleOperandOperator, getQueryContext, getWidget, getWidgetParameters, setJoinedPaths, setSolrFacetFieldName
Methods inherited from class org.ametys.runtime.model.DefaultElementDefinition
_defaultValueToJSON, _getDefaultValues, _getSimpleDefaultValue, _widgetToJSON, _widgetToSAX, getCustomEnumerator, getCustomValidator, getDefaultValue, getEnumeratorConfiguration, getParsedDefaultValues, getValidator, getValidatorConfiguration, isMultiple, of, setCustomEnumerator, setCustomValidator, setDefaultValue, setEnumerator, setEnumeratorConfiguration, setMultiple, setParsedDefaultValues, setType, setValidator, setValidatorConfiguration, setWidget, setWidgetParameters
Methods inherited from class org.ametys.runtime.model.AbstractModelItem
_getModelItemHelper, _shouldJSONBeEmpty, _widgetParameterToSAX, addItemChecker, compareTo, disableConditionsToJSON, equals, getDisableConditions, getItemCheckers, 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
convertQueryValue, getJoinedPaths, getQuery, getQuery, getSolrFacetFieldName, getType
Methods 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, setValidatorConfiguration
Methods inherited from interface org.ametys.runtime.util.Labelable
getDescription, getLabel
Methods inherited from interface org.ametys.runtime.model.ModelItem
addItemChecker, getDisableConditions, getItemCheckers, getParent, getPath, getPluginName, getWidget, getWidgetParameters, setDisableConditions, setModel, setParent, setPluginName, setType, setWidget, setWidgetParameters, toJSON
Methods inherited from interface org.ametys.runtime.util.ModifiableLabelable
setDescription, setLabel, setName
-
Field Details
-
CRITERION_DEFINITION_PREFIX
Prefix for name of referencing criterion definitions- See Also:
-
_operator
The criteria operator
-
-
Constructor Details
-
ReferencingSearchModelCriterionDefinition
Default constructor. -
ReferencingSearchModelCriterionDefinition
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
-
getContentTypeIds
Description copied from class:ReferencingCriterionDefinition
Retrieves the identifiers of the content types defining the reference- Overrides:
getContentTypeIds
in classReferencingCriterionDefinition<T>
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the identifiers of the content types defining the reference
-
getName
Description copied from interface:Labelable
Get the name.- Specified by:
getName
in interfaceLabelable
- Overrides:
getName
in classAbstractModelItem
- Returns:
- the name.
-
getQuery
public Query getQuery(Object value, Query.Operator customOperator, 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 classReferencingCriterionDefinition<T>
- Parameters:
value
- The user-submitted value (or the default value if not set) for this criterion.customOperator
- 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.
-
getOperator
Description copied from interface:SearchModelCriterionDefinition
Get the criterion Operator.- Specified by:
getOperator
in interfaceSearchModelCriterionDefinition<T>
- Returns:
- the criterion Operator.
-
_getDefaultOperator
Retrieves the default operator for the criterion- Returns:
- the default operator for the criterion
-
setOperator
Description copied from interface:SearchModelCriterionDefinition
Set the criterion Operator.- Specified by:
setOperator
in interfaceSearchModelCriterionDefinition<T>
- Parameters:
operator
- the Operator to set.
-
setMultipleOperandOperator
Description copied from interface:SearchModelCriterionDefinition
Set the the logical operator for multi-valued criteria- Specified by:
setMultipleOperandOperator
in interfaceSearchModelCriterionDefinition<T>
- Parameters:
multipleOperand
- the logical operator to set
-
_toJSON
Description copied from class:AbstractModelItem
Converts the model item in a JSON map- Overrides:
_toJSON
in classDefaultElementDefinition<T>
- Parameters:
context
- the context of the definition- Returns:
- The model item as a JSON map
-
toSAX
Description copied from interface:ModelItem
Generates SAX events for the model item- Specified by:
toSAX
in interfaceModelItem
- Overrides:
toSAX
in classDefaultElementDefinition<T>
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- the context of the definition- Throws:
SAXException
- if an error occurs during the SAX events generation
-
copyTo
public void copyTo(SearchModelCriterionDefinition<T> criterion, Map<String, Object> contextualParameters) Description copied from interface:SearchModelCriterionDefinition
Copy the current criterion definition in the given one.- Specified by:
copyTo
in interfaceSearchModelCriterionDefinition<T>
- Parameters:
criterion
- the copycontextualParameters
- the contextual parameters
-
getModel
Description copied from interface:ModelItem
Retrieves the model of the item- Specified by:
getModel
in interfaceModelItem
- Specified by:
getModel
in interfaceSearchModelCriterionDefinition<T>
- Overrides:
getModel
in classAbstractModelItem
- Returns:
- the model
-