Package org.ametys.web.filter
Class DefaultPageFilter
java.lang.Object
org.ametys.web.filter.DefaultPageFilter
- All Implemented Interfaces:
PageFilter
- Direct Known Subclasses:
StaticPageFilter
This is the default implementation of a
PageFilter
. The
filter's property are set by setter function and constructor-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.web.filter.PageFilter
PageFilter.Context, PageFilter.ContextLanguage
-
Field Summary
Modifier and TypeFieldDescriptionprotected PageFilter.Context
The context for searchprotected PageFilter.ContextLanguage
The context languageprotected int
The search depthprotected String
The filter idprotected int
The number max of resultsprotected Logger
The loggerThe metadata to matchprotected String
The parent page Idprotected AmetysObjectResolver
The Ametys object resolverprotected SortCriteria
The sort criteriaThe list of tags to matchprotected I18nizableText
The title -
Constructor Summary
ConstructorDescriptionEmpty constructorDefaultPageFilter
(String id, AmetysObjectResolver resolver) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMetadata
(String metadataId, String value) Add a metadata filtervoid
addSortCriteria
(String metadataId, boolean ascending, boolean useLowerCase) Add a sort criteriavoid
Add a tag to the filterGet the search contextprotected Expression
getContextExpression
(String siteName) Get theExpression
associated with the given site contextGet the context languageprotected Expression
Get theExpression
associated with the given language contextint
getDepth()
Get the search depthprotected Expression
Get the expression corresponding to this filtergetId()
Get the filter idint
Get the max number of resultsgetMatchingPages
(String siteName, String lang, Page page) Get the pages matching this filter.protected Expression
Get the expression corresponding to the filter's tagsGet the metadata id and value to matchGet the parent page idGet the sort criteria allows to sort query results.getTags()
Get the tag keys to match pagesprotected Expression
Get the expression corresponding to the filter's tagsgetTitle()
Get the titleprotected String
getXPathQuery
(String siteName, String lang) Creates the XPath query corresponding to this filter.protected String
getXPathQuery
(Page page, int depth) void
setContext
(PageFilter.Context context) Set the search contextvoid
setContextLanguage
(PageFilter.ContextLanguage contextLang) Set the context languagevoid
setDepth
(int depth) Set the search depthvoid
Set the filter id.void
setLength
(int length) Set the max number o resultsvoid
set the parent page Id.void
setResolver
(AmetysObjectResolver resolver) Set the ametys object resolver to execute queryvoid
setTitle
(I18nizableText title) Set the title
-
Field Details
-
_resolver
The Ametys object resolver -
_id
The filter id -
_tags
The list of tags to match -
_metadata
The metadata to match -
_context
The context for search -
_contextLang
The context language -
_depth
The search depth -
_pageId
The parent page Id -
_length
The number max of results -
_title
The title -
_sortCriteria
The sort criteria -
_logger
The logger
-
-
Constructor Details
-
DefaultPageFilter
public DefaultPageFilter()Empty constructor -
DefaultPageFilter
Constructor- Parameters:
id
- The filter idresolver
- The ametys object resolver to resolve filter's query
-
-
Method Details
-
getId
Description copied from interface:PageFilter
Get the filter id- Specified by:
getId
in interfacePageFilter
- Returns:
- The filter id
-
getLength
Description copied from interface:PageFilter
Get the max number of results- Specified by:
getLength
in interfacePageFilter
- Returns:
- The max number of results
-
getDepth
Description copied from interface:PageFilter
Get the search depth- Specified by:
getDepth
in interfacePageFilter
- Returns:
- The search depth
-
getTags
Description copied from interface:PageFilter
Get the tag keys to match pages- Specified by:
getTags
in interfacePageFilter
- Returns:
- The tag keys to match pages
-
getMetadataValues
Description copied from interface:PageFilter
Get the metadata id and value to match- Specified by:
getMetadataValues
in interfacePageFilter
- Returns:
- The metadata to match pages
-
getContext
Description copied from interface:PageFilter
Get the search context- Specified by:
getContext
in interfacePageFilter
- Returns:
- The search context
-
getContextLanguage
Description copied from interface:PageFilter
Get the context language- Specified by:
getContextLanguage
in interfacePageFilter
- Returns:
- The context language
-
getSortCriteria
Description copied from interface:PageFilter
Get the sort criteria allows to sort query results.- Specified by:
getSortCriteria
in interfacePageFilter
- Returns:
- the sort criteria
-
addTag
Description copied from interface:PageFilter
Add a tag to the filter- Specified by:
addTag
in interfacePageFilter
- Parameters:
tag
- The tag key to add
-
addMetadata
Description copied from interface:PageFilter
Add a metadata filter- Specified by:
addMetadata
in interfacePageFilter
- Parameters:
metadataId
- The metadata id.value
- The value to test. Set null to test existence
-
setContext
Description copied from interface:PageFilter
Set the search context- Specified by:
setContext
in interfacePageFilter
- Parameters:
context
- The search context to set
-
setContextLanguage
Description copied from interface:PageFilter
Set the context language- Specified by:
setContextLanguage
in interfacePageFilter
- Parameters:
contextLang
- The context language
-
setDepth
Description copied from interface:PageFilter
Set the search depth- Specified by:
setDepth
in interfacePageFilter
- Parameters:
depth
- The search depth. Set to0
for no depth limitation.
-
setId
Description copied from interface:PageFilter
Set the filter id.- Specified by:
setId
in interfacePageFilter
- Parameters:
id
- The id to set.
-
addSortCriteria
Description copied from interface:PageFilter
Add a sort criteria- Specified by:
addSortCriteria
in interfacePageFilter
- Parameters:
metadataId
- The metadata id to sortascending
- true to ascending sortuseLowerCase
-true
for case insensitive order on a string property
-
setResolver
Description copied from interface:PageFilter
Set the ametys object resolver to execute query- Specified by:
setResolver
in interfacePageFilter
- Parameters:
resolver
- The ametys object resolver to set
-
setLength
Description copied from interface:PageFilter
Set the max number o results- Specified by:
setLength
in interfacePageFilter
- Parameters:
length
- The max number of results
-
getMatchingPages
Description copied from interface:PageFilter
Get the pages matching this filter.- Specified by:
getMatchingPages
in interfacePageFilter
- Parameters:
siteName
- The current site name.lang
- The current language. Can be null.page
- The current page.- Returns:
- The matching pages.
-
getXPathQuery
Creates the XPath query corresponding to this filter.- Parameters:
siteName
- The current site namelang
- The current language- Returns:
- the created XPath query
-
getXPathQuery
- Parameters:
page
- The page where to start the searchdepth
- the search depth- Returns:
- the created XPath query
-
getFilterExpression
Get the expression corresponding to this filter- Returns:
- The created expression to match contents
-
getTagsExpression
Get the expression corresponding to the filter's tags- Returns:
- The expression corresponding to the filter's tags
-
getMetadataExpression
Get the expression corresponding to the filter's tags- Returns:
- The expression corresponding to the filter's tags
-
getContextExpression
Get theExpression
associated with the given site context- Parameters:
siteName
- The current site name- Returns:
- a
Expression
associated with the given site context
-
getContextLanguagesExpression
Get theExpression
associated with the given language context- Parameters:
lang
- The current language- Returns:
- a
Expression
associated with the given language context
-
getTitle
Description copied from interface:PageFilter
Get the title- Specified by:
getTitle
in interfacePageFilter
- Returns:
- The title
-
setTitle
Description copied from interface:PageFilter
Set the title- Specified by:
setTitle
in interfacePageFilter
- Parameters:
title
- The title
-
getPageId
Description copied from interface:PageFilter
Get the parent page id- Specified by:
getPageId
in interfacePageFilter
- Returns:
- The parent page id
-
setPageId
Description copied from interface:PageFilter
set the parent page Id.- Specified by:
setPageId
in interfacePageFilter
- Parameters:
pageId
- Id of the parent page (when fetching child of a page).
-