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
,PostFilter.PostFilterSearchContext
- Enclosing class:
- DefaultWebContentFilter
public class DefaultWebContentFilter.DefaultFilterSearchContext extends Object implements WebContentFilter.FilterSearchContext
Default implementation of a filter search context.
-
-
Field Summary
Fields Modifier and Type Field Description protected WebContentFilter.Context
_context
The context for searchprotected ContentFilter.ContextLanguage
_contextLang
The list of content languages to matchprotected int
_depth
The search depthprotected String
_pageId
The parent page Idprotected SiteManager
_siteManager
The list of content languages to matchprotected List<String>
_sites
The list of sites to matchprotected List<String>
_tags
The tags.protected boolean
_tagsAutoPosting
The tags auto postingprotected ContentFilter.Condition
_tagsCondition
The tags condition
-
Constructor Summary
Constructors Constructor Description DefaultFilterSearchContext(SiteManager siteManager)
Build a DefaultFilterSearchContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Tag
_getTag(String currentSiteName, String tagName)
Internal tag getter given the search contextvoid
addSite(String siteName)
Add a site to the filtervoid
addTag(String tag)
Add a tag to the filterWebContentFilter.Context
getContext()
Get the search contextprotected Expression
getContextExpression(String siteName)
Get theExpression
associated with the given site contextContentFilter.ContextLanguage
getContextLanguage()
Get the context languageprotected Expression
getContextLanguagesExpression(String lang)
Get theExpression
associated with the given language contextint
getDepth()
Get the search depthExpression
getFullExpression(String siteName, String language)
Get the Expression.String
getPageId()
Get the parent page idprotected Expression
getSharedContentsExpression(String currentSiteName)
Get the expression for shared contentsList<String>
getSites()
Get the site names to match contentsList<String>
getTags()
Get the tag keys to match contentsboolean
getTagsAutoPosting()
Is the tag auto posting enabled?ContentFilter.Condition
getTagsCondition()
The tags conditionExpression
getTagsExpression(String siteName)
Get the expression corresponding to the filter's tagsvoid
setContext(WebContentFilter.Context context)
Set the search contextvoid
setContextLanguage(ContentFilter.ContextLanguage language)
Set the context languagevoid
setDepth(int depth)
Set the search depthvoid
setPageId(String pageId)
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 Detail
-
_tagsCondition
protected ContentFilter.Condition _tagsCondition
The tags condition
-
_tagsAutoPosting
protected boolean _tagsAutoPosting
The tags auto posting
-
_context
protected WebContentFilter.Context _context
The context for search
-
_depth
protected int _depth
The search depth
-
_contextLang
protected ContentFilter.ContextLanguage _contextLang
The list of content languages to match
-
_siteManager
protected SiteManager _siteManager
The list of content languages to match
-
-
Constructor Detail
-
DefaultFilterSearchContext
public DefaultFilterSearchContext(SiteManager siteManager)
Build a DefaultFilterSearchContext.- Parameters:
siteManager
- the site manager.
-
-
Method Detail
-
getDepth
public int getDepth()
Description copied from interface:WebContentFilter.FilterSearchContext
Get the search depth- Specified by:
getDepth
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The search depth
-
getTags
public List<String> 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
public ContentFilter.Condition getTagsCondition()
Description copied from interface:WebContentFilter.FilterSearchContext
The tags condition- Specified by:
getTagsCondition
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The tags condition
-
getTagsAutoPosting
public boolean 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
public WebContentFilter.Context getContext()
Description copied from interface:WebContentFilter.FilterSearchContext
Get the search context- Specified by:
getContext
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The search context
-
getSites
public List<String> 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
public void addTag(String tag)
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
public void setTagsCondition(ContentFilter.Condition condition)
Description copied from interface:WebContentFilter.FilterSearchContext
Set the tags condition- Specified by:
setTagsCondition
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
condition
- The condition to set
-
setTagsAutoPosting
public void setTagsAutoPosting(boolean enable)
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
public void setContext(WebContentFilter.Context context)
Description copied from interface:WebContentFilter.FilterSearchContext
Set the search context- Specified by:
setContext
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
context
- The search context to set
-
addSite
public void addSite(String siteName)
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
public void setDepth(int depth)
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
public ContentFilter.ContextLanguage getContextLanguage()
Description copied from interface:WebContentFilter.FilterSearchContext
Get the context language- Specified by:
getContextLanguage
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The context language
-
setContextLanguage
public void setContextLanguage(ContentFilter.ContextLanguage language)
Description copied from interface:WebContentFilter.FilterSearchContext
Set the context language- Specified by:
setContextLanguage
in interfaceWebContentFilter.FilterSearchContext
- Parameters:
language
- The context language to set
-
getFullExpression
public Expression getFullExpression(String siteName, String language)
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
public Expression getTagsExpression(String siteName)
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
protected Tag _getTag(String currentSiteName, String tagName)
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
protected Expression getContextExpression(String siteName)
Get theExpression
associated with the given site context- Parameters:
siteName
- The current site name- Returns:
- a
Expression
associated with the given site context
-
getSharedContentsExpression
protected Expression getSharedContentsExpression(String currentSiteName)
Get the expression for shared contents- Parameters:
currentSiteName
- the current site name- Returns:
- the expression to aware of privacy of contents
-
getContextLanguagesExpression
protected Expression getContextLanguagesExpression(String lang)
Get theExpression
associated with the given language context- Parameters:
lang
- The current language- Returns:
- a
Expression
associated with the given language context
-
getPageId
public String getPageId()
Description copied from interface:WebContentFilter.FilterSearchContext
Get the parent page id- Specified by:
getPageId
in interfaceWebContentFilter.FilterSearchContext
- Returns:
- The parent page id
-
setPageId
public void setPageId(String pageId)
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).
-
-