Class IndexingFieldSearchUICriterion
- java.lang.Object
-
- org.ametys.runtime.parameter.Parameter<MetadataType>
-
- org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
-
- org.ametys.cms.search.ui.model.impl.IndexingFieldSearchUICriterion
-
- All Implemented Interfaces:
Field,IndexingFieldSearchCriterion,SearchCriterion,SearchUICriterion,LogEnabled,Disposable,Configurable,Contextualizable,Serviceable
public class IndexingFieldSearchUICriterion extends AbstractSearchUICriterion implements IndexingFieldSearchCriterion, Contextualizable, LogEnabled, Disposable
This class is a search criteria on a metadata of a content
-
-
Field Summary
Fields Modifier and Type Field Description private Context_contextprotected ThreadSafeComponentManager<Enumerator>_enumeratorManagerComponentManager forEnumerators.protected String_fieldPathThe field pathprotected String_fullPathThe field full pathprotected HierarchicalReferenceTablesHelper_hierarchicalReferenceTablesHelperThe content search helper.protected boolean_isMultipleOperandAndIs it AND or OR for multiple metadataprivate boolean_isTypeContentWithMultilingualTitleprotected List<String>_joinPathsThe join pathsprivate org.slf4j.Logger_loggerprivate ServiceManager_managerprotected Query.Operator_operatorThe criteria operatorprotected ContentSearchHelper_searchHelperThe content search helper.protected UserHelper_userHelperThe user helperprotected ThreadSafeComponentManager<Validator>_validatorManagerComponentManager forValidators.static StringSEARCH_CRITERIA_METADATA_PREFIXPrefix for id of metadata search criteria-
Fields inherited from class org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
_contentHelper, _cTypeEP, _resolver, _userManager, _userPopulationDAO
-
-
Constructor Summary
Constructors Constructor Description IndexingFieldSearchUICriterion()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_configureDescription(Configuration configuration, IndexingField indexingField, String fieldName, MetadataDefinition definition)private void_configureLabel(Configuration configuration, IndexingField indexingField, String fieldName, MetadataDefinition definition)private void_configureOperator(Configuration configuration, MetadataDefinition definition)Configure the criterion operator.private void_configureTypeContentWithMultilingualTitle(MetadataDefinition finalDefinition)private Query_getSingleDateQuery(String value, String fieldPath, Query.Operator operator)voidconfigure(Configuration configuration)voidcontextualize(Context context)voiddispose()protected QuerygetBooleanQuery(Object value, String fieldPath, Query.Operator operator)Get a boolean query.protected QuerygetContentQuery(Object value, String language, String fieldPath, Query.Operator operator)Get a content query.protected QuerygetDateQuery(Object value, String fieldPath, Query.Operator operator)Get a date query.protected QuerygetDoubleQuery(Object value, String fieldPath, Query.Operator operator)Get a double query.StringgetFieldId()Get the field identifier.StringgetFieldPath()Get the path of field (separated by '/')protected StringgetFieldPath(IndexingField indexingField, String[] remainingPathSegments)Get the field's path without join pathsprotected QuerygetGeocodeQuery(Object value, String fieldPath, Query.Operator operator)Get a geocode query.List<String>getJoinPaths()Get the join paths, separated with slashes.protected QuerygetLongQuery(Object value, String fieldPath, Query.Operator operator)Get a long query.protected MetadataDefinitiongetMetadataDefinition(IndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths)Get the metadata definition from the indexing field.Query.OperatorgetOperator()Get the operator.QuerygetQuery(Object value, Query.Operator customOperator, Map<String,Object> allValues, String language, Map<String,Object> contextualParameters)Get theQueryassociated to the given value.protected QuerygetRichTextQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped)Get a rich text query.SearchFieldgetSearchField()Get theSearchFieldrepresenting this search criterion.protected QuerygetStringQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped)Get a string query.protected QuerygetTextQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped)Get a text query.protected QuerygetUserQuery(Object value, String fieldPath, Query.Operator operator)Get a user queryprivate static booleanisEmpty(Object value)voidservice(ServiceManager manager)voidsetLogger(org.slf4j.Logger logger)Called at creation time to provide aLogger.-
Methods inherited from class org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
_configureI18nizableText, _initializeValidator, configureId, configureLabelsAndGroup, configureUIProperties, configureValues, configureWidget, configureWidgetParameters, getChangeClassName, getContentTypeId, getFacetLabel, getGroup, getInitClassName, getMetadataDefinition, getSubmitClassName, isHidden, isMultiple, setChangeClassName, setContentTypeId, setGroup, setHidden, setInitClassName, setMultiple, setSubmitClassName
-
Methods inherited from class org.ametys.runtime.parameter.Parameter
getDefaultValue, getDescription, getEnumerator, getId, getLabel, getPluginName, getType, getValidator, getWidget, getWidgetParameters, setDefaultValue, setDescription, setEnumerator, setId, setLabel, setPluginName, setType, setValidator, setWidget, setWidgetParameters
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.cms.search.model.Field
getContentTypeId, getEnumerator, getType, isMultiple
-
Methods inherited from interface org.ametys.cms.search.model.SearchCriterion
getId, getQuery, isFacetable, isSortable
-
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUICriterion
getDefaultValue, getDescription, getLabel, getValidator, getWidget, getWidgetParameters
-
-
-
-
Field Detail
-
SEARCH_CRITERIA_METADATA_PREFIX
public static final String SEARCH_CRITERIA_METADATA_PREFIX
Prefix for id of metadata search criteria- See Also:
- Constant Field Values
-
_searchHelper
protected ContentSearchHelper _searchHelper
The content search helper.
-
_hierarchicalReferenceTablesHelper
protected HierarchicalReferenceTablesHelper _hierarchicalReferenceTablesHelper
The content search helper.
-
_userHelper
protected UserHelper _userHelper
The user helper
-
_operator
protected Query.Operator _operator
The criteria operator
-
_fieldPath
protected String _fieldPath
The field path
-
_joinPaths
protected List<String> _joinPaths
The join paths
-
_isMultipleOperandAnd
protected boolean _isMultipleOperandAnd
Is it AND or OR for multiple metadata
-
_validatorManager
protected ThreadSafeComponentManager<Validator> _validatorManager
ComponentManager forValidators.
-
_enumeratorManager
protected ThreadSafeComponentManager<Enumerator> _enumeratorManager
ComponentManager forEnumerators.
-
_manager
private ServiceManager _manager
-
_logger
private org.slf4j.Logger _logger
-
_isTypeContentWithMultilingualTitle
private boolean _isTypeContentWithMultilingualTitle
-
-
Constructor Detail
-
IndexingFieldSearchUICriterion
public IndexingFieldSearchUICriterion()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
setLogger
public void setLogger(org.slf4j.Logger logger)
Description copied from interface:LogEnabledCalled at creation time to provide aLogger.- Specified by:
setLoggerin interfaceLogEnabled- Parameters:
logger- aLoggerfor messages.
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractSearchUICriterion- Throws:
ServiceException
-
dispose
public void dispose()
- Specified by:
disposein interfaceDisposable
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractSearchUICriterion- Throws:
ConfigurationException
-
getOperator
public Query.Operator getOperator()
Get the operator.- Specified by:
getOperatorin interfaceSearchCriterion- Returns:
- the operator.
-
getFieldId
public String getFieldId()
Description copied from interface:SearchUICriterionGet the field identifier. Used to match standard, advanced and faceted criterion (even if the operator is different), whatever their ID is.- Specified by:
getFieldIdin interfaceSearchUICriterion- Returns:
- the field identifier.
-
getFieldPath
public String getFieldPath()
Get the path of field (separated by '/')- Specified by:
getFieldPathin interfaceIndexingFieldSearchCriterion- Returns:
- the path of the field.
-
getJoinPaths
public List<String> getJoinPaths()
Get the join paths, separated with slashes.- Specified by:
getJoinPathsin interfaceIndexingFieldSearchCriterion- Returns:
- the join paths.
-
getQuery
public Query getQuery(Object value, Query.Operator customOperator, Map<String,Object> allValues, String language, Map<String,Object> contextualParameters)
Description copied from interface:SearchCriterionGet theQueryassociated to the given value.- Specified by:
getQueryin interfaceSearchCriterion- 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.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.
-
getStringQuery
protected Query getStringQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped)
Get a string query.- Parameters:
value- The value to use for this criterion.language- The search language.fieldPath- The field path.operator- The query operator to use.isValueEscaped-trueif the given value is already escaped- Returns:
- The query.
-
getBooleanQuery
protected Query getBooleanQuery(Object value, String fieldPath, Query.Operator operator)
Get a boolean query.- Parameters:
value- The value to use for this criterion.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
getDoubleQuery
protected Query getDoubleQuery(Object value, String fieldPath, Query.Operator operator)
Get a double query.- Parameters:
value- The value to use for this criterion.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
getLongQuery
protected Query getLongQuery(Object value, String fieldPath, Query.Operator operator)
Get a long query.- Parameters:
value- The value to use for this criterion.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
getDateQuery
protected Query getDateQuery(Object value, String fieldPath, Query.Operator operator)
Get a date query.- Parameters:
value- The value to use for this criterion.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
_getSingleDateQuery
private Query _getSingleDateQuery(String value, String fieldPath, Query.Operator operator)
-
getContentQuery
protected Query getContentQuery(Object value, String language, String fieldPath, Query.Operator operator)
Get a content query.- Parameters:
value- The value to use for this criterion.language- The search language.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
getUserQuery
protected Query getUserQuery(Object value, String fieldPath, Query.Operator operator)
Get a user query- Parameters:
value- The value to use for this criterion.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
getGeocodeQuery
protected Query getGeocodeQuery(Object value, String fieldPath, Query.Operator operator)
Get a geocode query.- Parameters:
value- The value to use for this criterion.fieldPath- The field path.operator- The query operator to use.- Returns:
- The query.
-
getRichTextQuery
protected Query getRichTextQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped)
Get a rich text query.- Parameters:
value- The value to use for this criterion.language- The search language.fieldPath- The field path.operator- The query operator to use.isValueEscaped-trueif the given value is already escaped- Returns:
- The query.
-
getTextQuery
protected Query getTextQuery(Object value, String language, String fieldPath, Query.Operator operator, boolean isValueEscaped)
Get a text query.- Parameters:
value- The value to use for this criterion.language- The search language.fieldPath- The field path.operator- The query operator to use.isValueEscaped-trueif the given value is already escaped- Returns:
- The query.
-
getSearchField
public SearchField getSearchField()
Description copied from interface:SearchCriterionGet theSearchFieldrepresenting this search criterion.- Specified by:
getSearchFieldin interfaceSearchCriterion- Overrides:
getSearchFieldin classAbstractSearchUICriterion- Returns:
- the
SearchFieldrepresenting this search criterion.
-
_configureTypeContentWithMultilingualTitle
private void _configureTypeContentWithMultilingualTitle(MetadataDefinition finalDefinition)
-
_configureOperator
private void _configureOperator(Configuration configuration, MetadataDefinition definition) throws ConfigurationException
Configure the criterion operator.- Parameters:
configuration- the global criterion configuration.definition- the metadata definition.- Throws:
ConfigurationException- if an error occurs.
-
_configureLabel
private void _configureLabel(Configuration configuration, IndexingField indexingField, String fieldName, MetadataDefinition definition)
-
_configureDescription
private void _configureDescription(Configuration configuration, IndexingField indexingField, String fieldName, MetadataDefinition definition)
-
getMetadataDefinition
protected MetadataDefinition getMetadataDefinition(IndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths) throws ConfigurationException
Get the metadata definition from the indexing field. Can be null if the last indexing field is a custom indexing field.- Parameters:
indexingField- The initial indexing fieldremainingPathSegments- The path to access the metadata or an another indexing field from the initial indexing fieldjoinPaths- The consecutive's path in case of joint to access the field/metadata- Returns:
- The metadata definition or null if not found
- Throws:
ConfigurationException- If an error occurs.
-
getFieldPath
protected String getFieldPath(IndexingField indexingField, String[] remainingPathSegments) throws ConfigurationException
Get the field's path without join paths- Parameters:
indexingField- The initial indexing fieldremainingPathSegments- The path to access the metadata or an another indexing field from the initial indexing field- Returns:
- the field's path
- Throws:
ConfigurationException- If an error occurs.
-
-