Package org.ametys.cms.filter
Interface ContentFilter
-
- All Known Subinterfaces:
WebContentFilter
- All Known Implementing Classes:
DefaultContentFilter
,DefaultWebContentFilter
,EventsFilter
,PostFilter
,StaticContentFilter
,StaticWebContentFilter
public interface ContentFilter
This interface represents a filter forContent
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ContentFilter.Condition
The condition.static class
ContentFilter.ContextLanguage
The context language
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
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 criteriaExpression
getAdditionalFilterExpression()
Get the current filter expressionList<String>
getContentTypes()
Get the content types to match contentsContentFilter.ContextLanguage
getContextLanguage()
Get the context languageString
getId()
Get the filter idint
getLength()
Get the max number of resultsAmetysObjectIterable<Content>
getMatchingContents()
Get the contents matching this filter.AmetysObjectIterable<Content>
getMatchingContents(String lang)
Get the contents matching this filter.ContentFilter.Condition
getMetadataCondition()
The metadata conditionMap<String,String>
getMetadataValues()
Get the content types to match contentsSortCriteria
getSortCriteria()
Get the sort criteria allows to sort query results.String
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
setContextLanguage(ContentFilter.ContextLanguage context)
Set the context languagevoid
setId(String id)
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
setView(String viewName)
Set the filter view
-
-
-
Method Detail
-
getContentTypes
List<String> getContentTypes()
Get the content types to match contents- Returns:
- The content types to match contents
-
addContentType
void addContentType(String cTypeId)
Add a content type to the filter- Parameters:
cTypeId
- The content type id to add
-
getMetadataValues
Map<String,String> getMetadataValues()
Get the content types to match contents- Returns:
- The content types to match contents
-
getMetadataCondition
ContentFilter.Condition getMetadataCondition()
The metadata condition- Returns:
- The metadata condition
-
addMetadata
void addMetadata(String metadataId, String value)
Add a metadata filter- Parameters:
metadataId
- The metadata id.value
- The value to test. Set null to test existence
-
setMetadataCondition
void setMetadataCondition(ContentFilter.Condition condition)
Set the metadata condition- Parameters:
condition
- The condition to set
-
getAdditionalFilterExpression
Expression getAdditionalFilterExpression()
Get the current filter expression- Returns:
- The expression. Can be null.
-
setAdditionalFilterExpression
void setAdditionalFilterExpression(Expression expression)
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
ContentFilter.ContextLanguage getContextLanguage()
Get the context language- Returns:
- The context language
-
setContextLanguage
void setContextLanguage(ContentFilter.ContextLanguage context)
Set the context language- Parameters:
context
- The context language to set
-
getView
String getView()
Get the name ofView
used for matching contents- Returns:
- The name of
View
used for matching contents
-
getLength
int getLength()
Get the max number of results- Returns:
- The max number of results
-
setLength
void setLength(int length)
Set the max number o results- Parameters:
length
- The max number of results
-
getSortCriteria
SortCriteria getSortCriteria()
Get the sort criteria allows to sort query results.- Returns:
- the sort criteria
-
addSortCriteria
void addSortCriteria(String metadataId, boolean ascending, boolean useLowerCase)
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
void setResolver(AmetysObjectResolver resolver)
Set the ametys object resolver to execute query- Parameters:
resolver
- The ametys object resolver to set
-
getMatchingContents
AmetysObjectIterable<Content> getMatchingContents()
Get the contents matching this filter.- Returns:
- The matching contents.
-
getMatchingContents
AmetysObjectIterable<Content> getMatchingContents(String lang)
Get the contents matching this filter.- Parameters:
lang
- The current language.- Returns:
- The matching contents.
-
-