Class SystemSearchUICriterion
- java.lang.Object
-
- org.ametys.runtime.parameter.Parameter<MetadataType>
-
- org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
-
- org.ametys.cms.search.ui.model.impl.SystemSearchUICriterion
-
- All Implemented Interfaces:
Field
,SearchCriterion
,SystemSearchCriterion
,SearchUICriterion
,LogEnabled
,Disposable
,Configurable
,Contextualizable
,Serviceable
public class SystemSearchUICriterion extends AbstractSearchUICriterion implements SystemSearchCriterion, Contextualizable, LogEnabled, Disposable
This class is a search criteria on a system property (author, lastModified, with-comments, ...)
-
-
Field Summary
Fields Modifier and Type Field Description private Set<String>
_contentTypes
private Context
_context
protected ThreadSafeComponentManager<Enumerator>
_enumeratorManager
ComponentManager forEnumerator
s.private String
_fullPath
protected List<String>
_joinPaths
The join pathsprivate org.slf4j.Logger
_logger
private ServiceManager
_manager
private Query.Operator
_operator
protected SystemPropertyExtensionPoint
_systemPropEP
The system property extension point.private SystemProperty
_systemProperty
protected ThreadSafeComponentManager<Validator>
_validatorManager
ComponentManager forValidator
s.static String
SEARCH_CRITERION_SYSTEM_PREFIX
Prefix for id of system property search criteria-
Fields inherited from class org.ametys.cms.search.ui.model.impl.AbstractSearchUICriterion
_contentHelper, _cTypeEP, _resolver, _userManager, _userPopulationDAO
-
-
Constructor Summary
Constructors Constructor Description SystemSearchUICriterion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private MetadataType
_computeJoinPaths(IndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths)
Get the indexing field type and compute the join paths.private List<String>
_configureJoinPaths(String joinPath, Set<String> contentTypeIds, Configuration configuration)
Configure the join paths.private Configuration
_getEnumeratorAndWidgetParamConf(Configuration critConf)
private String
_initializeEnumerator(SystemProperty.EnumeratorDefinition enumDef)
private Collection<String>
_typeAndSubTypes(List<String> singletonType)
void
configure(Configuration configuration)
void
contextualize(Context context)
void
dispose()
String
getFieldId()
Get the field identifier.Query.Operator
getOperator()
Get the operator.Query
getQuery(Object value, Query.Operator customOperator, Map<String,Object> allValues, String language, Map<String,Object> contextualParameters)
Get theQuery
associated to the given value.SearchField
getSearchField()
Get theSearchField
representing this search criterion.String
getSystemPropertyId()
Get id of this system propertyboolean
isFacetable()
Test if the criterion can be set as a facet (i.e.boolean
isJoined()
Returnstrue
if the criterion is joinedvoid
service(ServiceManager manager)
void
setLogger(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, isSortable
-
Methods inherited from interface org.ametys.cms.search.ui.model.SearchUICriterion
getDefaultValue, getDescription, getLabel, getValidator, getWidget, getWidgetParameters
-
-
-
-
Field Detail
-
SEARCH_CRITERION_SYSTEM_PREFIX
public static final String SEARCH_CRITERION_SYSTEM_PREFIX
Prefix for id of system property search criteria- See Also:
- Constant Field Values
-
_validatorManager
protected ThreadSafeComponentManager<Validator> _validatorManager
ComponentManager forValidator
s.
-
_enumeratorManager
protected ThreadSafeComponentManager<Enumerator> _enumeratorManager
ComponentManager forEnumerator
s.
-
_systemPropEP
protected SystemPropertyExtensionPoint _systemPropEP
The system property extension point.
-
_joinPaths
protected List<String> _joinPaths
The join paths
-
_operator
private Query.Operator _operator
-
_systemProperty
private SystemProperty _systemProperty
-
_contentTypes
private Set<String> _contentTypes
-
_manager
private ServiceManager _manager
-
_logger
private org.slf4j.Logger _logger
-
-
Constructor Detail
-
SystemSearchUICriterion
public SystemSearchUICriterion()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
setLogger
public void setLogger(org.slf4j.Logger logger)
Description copied from interface:LogEnabled
Called at creation time to provide aLogger
.- Specified by:
setLogger
in interfaceLogEnabled
- Parameters:
logger
- aLogger
for messages.
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSearchUICriterion
- Throws:
ServiceException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractSearchUICriterion
- Throws:
ConfigurationException
-
_getEnumeratorAndWidgetParamConf
private Configuration _getEnumeratorAndWidgetParamConf(Configuration critConf) throws ConfigurationException
- Throws:
ConfigurationException
-
isJoined
public boolean isJoined()
Description copied from interface:SystemSearchCriterion
Returnstrue
if the criterion is joined- Specified by:
isJoined
in interfaceSystemSearchCriterion
- Returns:
true
if the criterion is joined
-
isFacetable
public boolean isFacetable()
Description copied from interface:SearchCriterion
Test if the criterion can be set as a facet (i.e. it has a defined list of discrete values).- Specified by:
isFacetable
in interfaceSearchCriterion
- Returns:
- true if the criterion can be set as a facet, false otherwise.
-
getOperator
public Query.Operator getOperator()
Get the operator.- Specified by:
getOperator
in interfaceSearchCriterion
- Returns:
- the operator.
-
getFieldId
public String getFieldId()
Description copied from interface:SearchUICriterion
Get the field identifier. Used to match standard, advanced and faceted criterion (even if the operator is different), whatever their ID is.- Specified by:
getFieldId
in interfaceSearchUICriterion
- Returns:
- the field identifier.
-
getSystemPropertyId
public String getSystemPropertyId()
Get id of this system property- Specified by:
getSystemPropertyId
in interfaceSystemSearchCriterion
- Returns:
- The system property's id
-
getQuery
public Query getQuery(Object value, Query.Operator customOperator, Map<String,Object> allValues, String language, Map<String,Object> contextualParameters)
Description copied from interface:SearchCriterion
Get theQuery
associated to the given value.- Specified by:
getQuery
in 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.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.
-
getSearchField
public SearchField getSearchField()
Description copied from interface:SearchCriterion
Get theSearchField
representing this search criterion.- Specified by:
getSearchField
in interfaceSearchCriterion
- Overrides:
getSearchField
in classAbstractSearchUICriterion
- Returns:
- the
SearchField
representing this search criterion.
-
_configureJoinPaths
private List<String> _configureJoinPaths(String joinPath, Set<String> contentTypeIds, Configuration configuration) throws ConfigurationException
Configure the join paths.- Parameters:
joinPath
- The full join path.contentTypeIds
- The base content type identifiers.configuration
- The configuration of the criterion- Returns:
- The list of join paths.
- Throws:
ConfigurationException
- If the join paths are missconfigured
-
_computeJoinPaths
private MetadataType _computeJoinPaths(IndexingField indexingField, String[] remainingPathSegments, List<String> joinPaths) throws ConfigurationException
Get the indexing field type and compute the join paths.- 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.
-
_typeAndSubTypes
private Collection<String> _typeAndSubTypes(List<String> singletonType)
-
_initializeEnumerator
private String _initializeEnumerator(SystemProperty.EnumeratorDefinition enumDef)
-
-