Package org.ametys.cms.filter
Class StaticContentFilter
- java.lang.Object
-
- org.ametys.cms.filter.DefaultContentFilter
-
- org.ametys.cms.filter.StaticContentFilter
-
- All Implemented Interfaces:
ContentFilter
,PluginAware
,Configurable
,Serviceable
public class StaticContentFilter extends DefaultContentFilter implements Configurable, PluginAware, Serviceable
Class representing a content filter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StaticContentFilter.DynamicDateExpression
Constructs anExpression
representing a comparison between a metadata and the time the build() method is called.-
Nested classes/interfaces inherited from interface org.ametys.cms.filter.ContentFilter
ContentFilter.Condition, ContentFilter.ContextLanguage
-
-
Field Summary
Fields Modifier and Type Field Description protected String
_featureName
The feature nameprotected String
_pluginName
The plugin name-
Fields inherited from class org.ametys.cms.filter.DefaultContentFilter
_additionalFilterExpression, _contentTypeEP, _contentTypes, _contextLang, _id, _length, _metadata, _metadataCondition, _resolver, _sortCriteria, _srcResolver, _viewName
-
-
Constructor Summary
Constructors Constructor Description StaticContentFilter()
ConstructorStaticContentFilter(String id, StaticContentFilter originalFilter, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint)
Creates a new filter from copy of anotherStaticContentFilter(String id, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Expression
_configureComplexMetadata(Configuration configuration, ContentFilter.Condition metadataOperator)
Configure complex metadata conditions (may filter on non-string metadata, and not limited to equality.)protected List<String>
_configureContentTypes(Configuration configuration)
Configure the content type idsprotected ContentFilter.ContextLanguage
_configureContextLanguage(Configuration configuration)
Configure the context languageprotected Map<String,String>
_configureMetadata(Configuration configuration)
Configure simple metadata clauses (fixed string values).protected SortCriteria
_configureSortCriteria(Configuration configuration)
Configure the sort criteriaprotected Expression
_getComplexDateExpression(String metadataName, String operator, String value, Configuration configuration)
Get a complex date metadata expression.void
configure(Configuration configuration)
void
service(ServiceManager smanager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.cms.filter.DefaultContentFilter
addContentType, addMetadata, addSortCriteria, getAdditionalFilterExpression, getContentTypes, getContentTypesExpression, getContextLanguage, getContextLanguagesExpression, getFilterExpression, getId, getLength, getMatchingContents, getMatchingContents, getMetadataCondition, getMetadataExpression, getMetadataValues, getSortCriteria, getView, getXPathQuery, getXPathQuery, setAdditionalFilterExpression, setContextLanguage, setId, setLength, setMetadataCondition, setResolver, setView
-
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
The plugin name
-
_featureName
protected String _featureName
The feature name
-
-
Constructor Detail
-
StaticContentFilter
public StaticContentFilter()
Constructor
-
StaticContentFilter
public StaticContentFilter(String id, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint)
Constructor- Parameters:
id
- The filter idresolver
- The ametys object resolvercontentTypeExtensionPoint
- The extension point for content types
-
StaticContentFilter
public StaticContentFilter(String id, StaticContentFilter originalFilter, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint)
Creates a new filter from copy of another- Parameters:
id
- The filter unique identifieroriginalFilter
- The original filter to be copiedresolver
- The ametys object resolvercontentTypeExtensionPoint
- The extension point for content types
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_configureContentTypes
protected List<String> _configureContentTypes(Configuration configuration) throws ConfigurationException
Configure the content type ids- Parameters:
configuration
- The content types configuration- Returns:
- The set of content type ids
- Throws:
ConfigurationException
- If an error occurs
-
_configureMetadata
protected Map<String,String> _configureMetadata(Configuration configuration) throws ConfigurationException
Configure simple metadata clauses (fixed string values).- Parameters:
configuration
- The metadata configuration- Returns:
- The metadata to filter by, as a Map of metadata name -> value.
- Throws:
ConfigurationException
- If an error occurs
-
_configureComplexMetadata
protected Expression _configureComplexMetadata(Configuration configuration, ContentFilter.Condition metadataOperator) throws ConfigurationException
Configure complex metadata conditions (may filter on non-string metadata, and not limited to equality.)- Parameters:
configuration
- The metadata conditions configuration.metadataOperator
- the metadata operator.- Returns:
- An expression for complex metadata conditions.
- Throws:
ConfigurationException
- If an error occurs
-
_getComplexDateExpression
protected Expression _getComplexDateExpression(String metadataName, String operator, String value, Configuration configuration) throws ConfigurationException
Get a complex date metadata expression.- Parameters:
metadataName
- the metadata name.operator
- the comparison operator.value
- the compared value.configuration
- the configuration being processed.- Returns:
- the date Expression.
- Throws:
ConfigurationException
- if the configuration is not valid.
-
_configureSortCriteria
protected SortCriteria _configureSortCriteria(Configuration configuration) throws ConfigurationException
Configure the sort criteria- Parameters:
configuration
- The sort criteria configuration- Returns:
- The sort criteria
- Throws:
ConfigurationException
- If an error occurs
-
_configureContextLanguage
protected ContentFilter.ContextLanguage _configureContextLanguage(Configuration configuration) throws ConfigurationException
Configure the context language- Parameters:
configuration
- The context configuration- Returns:
- The context language
- Throws:
ConfigurationException
- If an error occurs
-
-