Package org.ametys.cms.search.model
Class SearchModelCriterionDefinitionHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.search.model.SearchModelCriterionDefinitionHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class SearchModelCriterionDefinitionHelper
extends AbstractLogEnabled
implements Component, Serviceable
Helper for referencing
CriterionDefinition
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentSearchHelper
The content search helperprotected ContentTypeExtensionPoint
The content type extension pointprotected ContentTypesHelper
The content types helperprotected CriterionDefinitionHelper
The criterion definition helperprotected SearchModelHelper
The search model helperprotected SystemPropertyExtensionPoint
The system property extension pointstatic final String
The component role. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateReferencingCriterionDefinition
(ElementDefinition reference, String referencePath) Retrieves aSearchModelCriterionDefinition
referencing the given definitioncreateReferencingCriterionDefinition
(Model searchModel, String referencePath, Set<String> contentTypeIds) Retrieves aSearchModelCriterionDefinition
referencing the element at the given pathgetContentTypesQuery
(SearchModelCriterionDefinition criterion, ContentTypeSystemProperty reference, Object value, Query.Operator customOperator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Get theQuery
associated to the given value for the criterion referencing content typesgetLanguageValue
(SearchModelCriterionDefinition criterion, Object value, Map<String, Object> allValues, Map<String, Object> contextualParameters) Retrieves the language associated to the given value.Class
<? extends SearchModelCriterionDefinition> getStaticCriterionDefinitionClass
(Set<ContentType> contentTypes, String reference) Retrieves theClass
to use instantiate a criterion for the given referencevoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role. -
_contentTypeExtensionPoint
The content type extension point -
_systemPropertyExtensionPoint
The system property extension point -
_contentTypesHelper
The content types helper -
_contentSearchHelper
The content search helper -
_searchModelHelper
The search model helper -
_criterionDefinitionHelper
The criterion definition helper
-
-
Constructor Details
-
SearchModelCriterionDefinitionHelper
public SearchModelCriterionDefinitionHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
createReferencingCriterionDefinition
public SearchModelCriterionDefinition createReferencingCriterionDefinition(Model searchModel, String referencePath, Set<String> contentTypeIds) Retrieves aSearchModelCriterionDefinition
referencing the element at the given path- Parameters:
searchModel
- TheSearchModel
defining this criterionreferencePath
- the path of the element to referencecontentTypeIds
- the identifiers of the content types containing the reference- Returns:
- the
SearchModelCriterionDefinition
. Can benull
if the reference can not be used as a criterion
-
createReferencingCriterionDefinition
public SearchModelCriterionDefinition createReferencingCriterionDefinition(ElementDefinition reference, String referencePath) Retrieves aSearchModelCriterionDefinition
referencing the given definition- Parameters:
reference
- the definition of the element to referencereferencePath
- the path of the reference from the model containing the reference- Returns:
- the
SearchModelCriterionDefinition
. Can benull
if the reference can not be used as a criterion
-
getStaticCriterionDefinitionClass
public Class<? extends SearchModelCriterionDefinition> getStaticCriterionDefinitionClass(Set<ContentType> contentTypes, String reference) Retrieves theClass
to use instantiate a criterion for the given reference- Parameters:
contentTypes
- the content types declaring the referenced itemreference
- the reference- Returns:
- the
Class
to use instantiate the criterion. Can benull
if the reference can not be used as a criterion
-
getLanguageValue
public String getLanguageValue(SearchModelCriterionDefinition criterion, Object value, Map<String, Object> allValues, Map<String, Object> contextualParameters) Retrieves the language associated to the given value.- Parameters:
criterion
- the criterionvalue
- The user-submitted value (or the default value if not set) for the language criterion.allValues
- All the user-submitted values.contextualParameters
- the search contextual parameters.- Returns:
- the language associated to the given value.
-
getContentTypesQuery
public Query getContentTypesQuery(SearchModelCriterionDefinition criterion, ContentTypeSystemProperty reference, Object value, Query.Operator customOperator, Map<String, Object> allValues, String language, Map<String, Object> contextualParameters) Get theQuery
associated to the given value for the criterion referencing content types- Parameters:
criterion
- the criterionreference
- the content typesSystemProperty
referenced by the given criterionvalue
- The user-submitted value (or the default value if not set) for the 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:
- The content types
Query
associated to the given value.
-