Package org.ametys.web.filter
Class DefaultWebContentFilter.DefaultFilterSearchContext
java.lang.Object
org.ametys.web.filter.DefaultWebContentFilter.DefaultFilterSearchContext
- All Implemented Interfaces:
WebContentFilter.FilterSearchContext
- Direct Known Subclasses:
EventsFilter.EventFilterSearchContext
- Enclosing class:
- DefaultWebContentFilter
public class DefaultWebContentFilter.DefaultFilterSearchContext
extends Object
implements WebContentFilter.FilterSearchContext
Default implementation of a filter search context.
-
Field Summary
Modifier and TypeFieldDescriptionprotected WebContentFilter.Context
The context for searchprotected ContentFilter.ContextLanguage
The list of content languages to matchprotected int
The search depthprotected String
The parent page Idprotected SiteManager
The list of content languages to matchThe list of sites to matchThe tags.protected boolean
The tags auto postingprotected ContentFilter.Condition
The tags condition -
Constructor Summary
ConstructorDescriptionDefaultFilterSearchContext
(SiteManager siteManager) Build a DefaultFilterSearchContext. -
Method Summary
Modifier and TypeMethodDescriptionprotected Tag
Internal tag getter given the search contextvoid
Add a site to the filtervoid
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 depthgetFullExpression
(String siteName, String language) Get the Expression.Get the parent page idprotected Expression
getSharedContentsExpression
(String currentSiteName) Get the expression for shared contentsgetSites()
Get the site names to match contentsgetTags()
Get the tag keys to match contentsboolean
Is the tag auto posting enabled?The tags conditiongetTagsExpression
(String siteName) Get the expression corresponding to the filter's tagsvoid
setContext
(WebContentFilter.Context context) Set the search contextvoid
Set the context languagevoid
setDepth
(int depth) Set the search depthvoid
set the parent page Id.void
setTagsAutoPosting
(boolean enable) Enable/disable the tag autoposting feature.void
setTagsCondition
(ContentFilter.Condition condition) Set the tags condition
-
Field Details
-
_tags
The tags. -
_tagsCondition
The tags condition -
_tagsAutoPosting
The tags auto posting -
_context
The context for search -
_sites
The list of sites to match -
_depth
The search depth -
_contextLang
The list of content languages to match -
_pageId
The parent page Id -
_siteManager
The list of content languages to match
-
-
Constructor Details
-
DefaultFilterSearchContext
Build a DefaultFilterSearchContext.- Parameters:
siteManager
- the site manager.
-
-
Method Details
-
getDepth
Description copied from interface:WebContentFilter.FilterSearchContext
Get the search depth- Specified by:
getDepth
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The search depth
-
getTags
Description copied from interface:WebContentFilter.FilterSearchContext
Get the tag keys to match contents- Specified by:
getTags
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The tag keys to match contents
-
getTagsCondition
Description copied from interface:WebContentFilter.FilterSearchContext
The tags condition- Specified by:
getTagsCondition
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The tags condition
-
getTagsAutoPosting
Description copied from interface:WebContentFilter.FilterSearchContext
Is the tag auto posting enabled?- Specified by:
getTagsAutoPosting
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- true if it is
-
getContext
Description copied from interface:WebContentFilter.FilterSearchContext
Get the search context- Specified by:
getContext
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The search context
-
getSites
Description copied from interface:WebContentFilter.FilterSearchContext
Get the site names to match contents- Specified by:
getSites
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The the site names to match contents
-
addTag
Description copied from interface:WebContentFilter.FilterSearchContext
Add a tag to the filter- Specified by:
addTag
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
tag
- The tag key to add
-
setTagsCondition
Description copied from interface:WebContentFilter.FilterSearchContext
Set the tags condition- Specified by:
setTagsCondition
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
condition
- The condition to set
-
setTagsAutoPosting
Description copied from interface:WebContentFilter.FilterSearchContext
Enable/disable the tag autoposting feature.- Specified by:
setTagsAutoPosting
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
enable
- True to enable the autposting, false to remains in strict match mode.
-
setContext
Description copied from interface:WebContentFilter.FilterSearchContext
Set the search context- Specified by:
setContext
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
context
- The search context to set
-
addSite
Description copied from interface:WebContentFilter.FilterSearchContext
Add a site to the filter- Specified by:
addSite
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
siteName
- The site name to add
-
setDepth
Description copied from interface:WebContentFilter.FilterSearchContext
Set the search depth- Specified by:
setDepth
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
depth
- The search depth. Set to0
for no depth limitation.
-
getContextLanguage
Description copied from interface:WebContentFilter.FilterSearchContext
Get the context language- Specified by:
getContextLanguage
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The context language
-
setContextLanguage
Description copied from interface:WebContentFilter.FilterSearchContext
Set the context language- Specified by:
setContextLanguage
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
language
- The context language to set
-
getFullExpression
Description copied from interface:WebContentFilter.FilterSearchContext
Get the Expression.- Specified by:
getFullExpression
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
siteName
- the site namelanguage
- the language- Returns:
- the expression.
-
getTagsExpression
Description copied from interface:WebContentFilter.FilterSearchContext
Get the expression corresponding to the filter's tags- Specified by:
getTagsExpression
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
siteName
- The current site name- Returns:
- The expression corresponding to the filter's tags
-
_getTag
Internal tag getter given the search context- Parameters:
currentSiteName
- The name of the current sitetagName
- the name of the tag- Returns:
- The tag or null
-
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
-
getPageId
Description copied from interface:WebContentFilter.FilterSearchContext
Get the parent page id- Specified by:
getPageId
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The parent page id
-
setPageId
Description copied from interface:WebContentFilter.FilterSearchContext
set the parent page Id.- Specified by:
setPageId
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
pageId
- Id of the parent page (when fetching child of a page).
-