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 ContentSearchHelperThe content search helperprotected ContentTypeExtensionPointThe content type extension pointprotected ContentTypesHelperThe content types helperprotected CriterionDefinitionHelperThe criterion definition helperprotected SearchModelHelperThe search model helperprotected SystemPropertyExtensionPointThe system property extension pointstatic final StringThe component role. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateReferencingCriterionDefinition(ElementDefinition reference, String referencePath) Retrieves aSearchModelCriterionDefinitionreferencing the given definitioncreateReferencingCriterionDefinition(Model searchModel, String referencePath, Set<String> contentTypeIds) Retrieves aSearchModelCriterionDefinitionreferencing 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 theQueryassociated 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 theClassto use instantiate a criterion for the given referencevoidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
createReferencingCriterionDefinition
public SearchModelCriterionDefinition createReferencingCriterionDefinition(Model searchModel, String referencePath, Set<String> contentTypeIds) Retrieves aSearchModelCriterionDefinitionreferencing the element at the given path- Parameters:
searchModel- TheSearchModeldefining this criterionreferencePath- the path of the element to referencecontentTypeIds- the identifiers of the content types containing the reference- Returns:
- the
SearchModelCriterionDefinition. Can benullif the reference can not be used as a criterion
-
createReferencingCriterionDefinition
public SearchModelCriterionDefinition createReferencingCriterionDefinition(ElementDefinition reference, String referencePath) Retrieves aSearchModelCriterionDefinitionreferencing 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 benullif the reference can not be used as a criterion
-
getStaticCriterionDefinitionClass
public Class<? extends SearchModelCriterionDefinition> getStaticCriterionDefinitionClass(Set<ContentType> contentTypes, String reference) Retrieves theClassto use instantiate a criterion for the given reference- Parameters:
contentTypes- the content types declaring the referenced itemreference- the reference- Returns:
- the
Classto use instantiate the criterion. Can benullif 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 theQueryassociated to the given value for the criterion referencing content types- Parameters:
criterion- the criterionreference- the content typesSystemPropertyreferenced 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.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:
- The content types
Queryassociated to the given value.
-