Package org.ametys.cms.filter
Interface ContentFilter
- All Known Subinterfaces:
WebContentFilter
- All Known Implementing Classes:
DefaultContentFilter
,DefaultWebContentFilter
,EventsFilter
,StaticContentFilter
,StaticWebContentFilter
public interface ContentFilter
This interface represents a filter for
Content
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The condition.static enum
The context language -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContentType
(String cTypeId) Add a content type to the filtervoid
addMetadata
(String metadataId, String value) Add a metadata filtervoid
addSortCriteria
(String metadataId, boolean ascending, boolean useLowerCase) Add a sort criteriaGet the current filter expressionGet the content types to match contentsGet the context languagegetId()
Get the filter idint
Get the max number of resultsGet the contents matching this filter.getMatchingContents
(String lang) Get the contents matching this filter.The metadata conditionGet the content types to match contentsGet the sort criteria allows to sort query results.getView()
Get the name ofView
used for matching contentsvoid
setAdditionalFilterExpression
(Expression expression) Set the filter expression that should complete metadata filtering (by doing an AND between both)void
Set the context languagevoid
Set the filter id.void
setLength
(int length) Set the max number o resultsvoid
setMetadataCondition
(ContentFilter.Condition condition) Set the metadata conditionvoid
setResolver
(AmetysObjectResolver resolver) Set the ametys object resolver to execute queryvoid
Set the filter view
-
Method Details
-
getId
Get the filter id- Returns:
- The filter id
-
setId
Set the filter id.- Parameters:
id
- The id to set.
-
getContentTypes
Get the content types to match contents- Returns:
- The content types to match contents
-
addContentType
Add a content type to the filter- Parameters:
cTypeId
- The content type id to add
-
getMetadataValues
Get the content types to match contents- Returns:
- The content types to match contents
-
getMetadataCondition
The metadata condition- Returns:
- The metadata condition
-
addMetadata
Add a metadata filter- Parameters:
metadataId
- The metadata id.value
- The value to test. Set null to test existence
-
setMetadataCondition
Set the metadata condition- Parameters:
condition
- The condition to set
-
getAdditionalFilterExpression
Get the current filter expression- Returns:
- The expression. Can be null.
-
setAdditionalFilterExpression
Set the filter expression that should complete metadata filtering (by doing an AND between both)- Parameters:
expression
- The expression to set. Can be null to remove curren expression
-
getContextLanguage
Get the context language- Returns:
- The context language
-
setContextLanguage
Set the context language- Parameters:
context
- The context language to set
-
getView
Get the name ofView
used for matching contents- Returns:
- The name of
View
used for matching contents
-
setView
Set the filter view- Parameters:
viewName
- The name ofView
-
getLength
int getLength()Get the max number of results- Returns:
- The max number of results
-
setLength
Set the max number o results- Parameters:
length
- The max number of results
-
getSortCriteria
Get the sort criteria allows to sort query results.- Returns:
- the sort criteria
-
addSortCriteria
Add a sort criteria- Parameters:
metadataId
- The metadata id to sortascending
- true to ascending sortuseLowerCase
-true
for case insensitive order on a string property
-
setResolver
Set the ametys object resolver to execute query- Parameters:
resolver
- The ametys object resolver to set
-
getMatchingContents
Get the contents matching this filter.- Returns:
- The matching contents.
-
getMatchingContents
Get the contents matching this filter.- Parameters:
lang
- The current language.- Returns:
- The matching contents.
-