public class DefaultWebContentFilter extends DefaultContentFilter implements WebContentFilter
WebContentFilter
. The filter's property are set by setter function and constructorModifier and Type | Class and Description |
---|---|
protected class |
DefaultWebContentFilter.ContentComparator
Compares two contents based on a given list of sort criteria.
|
class |
DefaultWebContentFilter.DefaultFilterSearchContext
Default implementation of a filter search context.
|
WebContentFilter.AccessLimitation, WebContentFilter.Context, WebContentFilter.FilterSearchContext
ContentFilter.Condition, ContentFilter.ContextLanguage
Modifier and Type | Field and Description |
---|---|
protected WebContentFilter.AccessLimitation |
_accessLimitation
The access limitation
|
protected I18nizableText |
_description
The description
|
protected Logger |
_logger
The logger
|
protected boolean |
_maskOrphan
The mask orphan contents property
|
protected List<WebContentFilter.FilterSearchContext> |
_searchContexts
The search contexts.
|
protected SiteManager |
_siteManager
The site manager
|
protected TagProviderExtensionPoint |
_tagProviderEP
The tag provider
|
protected I18nizableText |
_title
The title
|
_additionalFilterExpression, _contentTypeEP, _contentTypes, _contextLang, _id, _length, _metadata, _metadataCondition, _metadataSetName, _resolver, _sortCriteria, _srcResolver
Constructor and Description |
---|
DefaultWebContentFilter()
Constructor
|
DefaultWebContentFilter(String id,
AmetysObjectResolver resolver,
ContentTypeExtensionPoint contentTypeExtensionPoint,
SiteManager siteManager,
TagProviderExtensionPoint tagProviderEP)
Creates a new filter
|
DefaultWebContentFilter(String id,
DefaultWebContentFilter originalFilter,
AmetysObjectResolver resolver,
ContentTypeExtensionPoint contentTypeExtensionPoint,
SiteManager siteManager,
TagProviderExtensionPoint tagProviderEP)
Creates a new filter from copy of another
|
Modifier and Type | Method and Description |
---|---|
private static String |
_encode(String path) |
void |
addMetadata(String metadataId,
String value)
Add a metadata filter
|
WebContentFilter.FilterSearchContext |
addSearchContext()
Add a search context.
|
protected WebContentFilter.FilterSearchContext |
createSeachContext()
Create a search context.
|
WebContentFilter.AccessLimitation |
getAccessLimitation()
Determines the access limitation policy.
|
ContentFilter.ContextLanguage |
getContextLanguage()
Get the context language
|
I18nizableText |
getDescription()
Get the filter's description
|
protected Expression |
getFilterExpression(String siteName,
WebContentFilter.FilterSearchContext filterContext)
Get the filter expression for a given search context.
|
AmetysObjectIterable<Content> |
getMatchingContents(String siteName,
String lang,
Page page)
Get the contents matching this filter.<br/>
In most cases, the results will need to be re-filtered by the
ContentFilterHelper.isContentValid(org.ametys.cms.repository.Content, org.ametys.web.repository.page.Page, org.ametys.cms.filter.ContentFilter) method. |
protected AmetysObjectIterable<Content> |
getMatchingContents(String siteName,
String lang,
Page page,
WebContentFilter.FilterSearchContext filterContext)
Get the matching contents for the given search context.
|
List<WebContentFilter.FilterSearchContext> |
getSearchContexts()
Get the list of search contexts.
|
I18nizableText |
getTitle()
Get the filter's title
|
protected String |
getXPathQuery(String siteName,
Page page,
int depth,
WebContentFilter.FilterSearchContext filterContext)
|
String |
getXPathQuery(String siteName,
String lang,
WebContentFilter.FilterSearchContext filterContext)
Creates the XPath query corresponding to this filter.
|
boolean |
maskOrphanContents()
Determines if orphan contents must be masked
|
void |
setAccessLimitation(WebContentFilter.AccessLimitation limitation)
Set the access limitation policy.
|
void |
setContextLanguage(ContentFilter.ContextLanguage context)
Set the context language
|
void |
setDescription(I18nizableText description)
Set the filter's description
|
void |
setMaskOrphanContents(boolean mask)
Set if orphan contents must be masked
|
void |
setTitle(I18nizableText title)
Set the filter's title
|
addContentType, addSortCriteria, getAdditionalFilterExpression, getContentTypes, getContentTypesExpression, getContextLanguagesExpression, getFilterExpression, getId, getLength, getMatchingContents, getMatchingContents, getMetadataCondition, getMetadataExpression, getMetadataValues, getSortCriteria, getView, getXPathQuery, getXPathQuery, setAdditionalFilterExpression, setId, setLength, setMetadataCondition, setResolver, setView
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addContentType, addSortCriteria, getAdditionalFilterExpression, getContentTypes, getId, getLength, getMatchingContents, getMatchingContents, getMetadataCondition, getMetadataValues, getSortCriteria, getView, setAdditionalFilterExpression, setId, setLength, setMetadataCondition, setResolver, setView
protected List<WebContentFilter.FilterSearchContext> _searchContexts
protected boolean _maskOrphan
protected WebContentFilter.AccessLimitation _accessLimitation
protected I18nizableText _title
protected I18nizableText _description
protected SiteManager _siteManager
protected TagProviderExtensionPoint _tagProviderEP
public DefaultWebContentFilter()
public DefaultWebContentFilter(String id, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint, SiteManager siteManager, TagProviderExtensionPoint tagProviderEP)
id
- The filter unique identifierresolver
- The ametys object resolvercontentTypeExtensionPoint
- The extension point for content typessiteManager
- The site managertagProviderEP
- The tag providerpublic DefaultWebContentFilter(String id, DefaultWebContentFilter originalFilter, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint, SiteManager siteManager, TagProviderExtensionPoint tagProviderEP)
id
- The filter unique identifieroriginalFilter
- The original filter to be copiedresolver
- The ametys object resolvercontentTypeExtensionPoint
- The extension point for content typessiteManager
- The site managertagProviderEP
- The tag providerpublic I18nizableText getTitle()
WebContentFilter
getTitle
in interface WebContentFilter
public void setTitle(I18nizableText title)
WebContentFilter
setTitle
in interface WebContentFilter
title
- The title to setpublic I18nizableText getDescription()
WebContentFilter
getDescription
in interface WebContentFilter
public void setDescription(I18nizableText description)
WebContentFilter
setDescription
in interface WebContentFilter
description
- The description to setpublic ContentFilter.ContextLanguage getContextLanguage()
ContentFilter
getContextLanguage
in interface ContentFilter
getContextLanguage
in class DefaultContentFilter
public void setContextLanguage(ContentFilter.ContextLanguage context)
ContentFilter
setContextLanguage
in interface ContentFilter
setContextLanguage
in class DefaultContentFilter
context
- The context language to setpublic void addMetadata(String metadataId, String value)
ContentFilter
addMetadata
in interface ContentFilter
addMetadata
in class DefaultContentFilter
metadataId
- The metadata id.value
- The value to test. Set null to test existencepublic List<WebContentFilter.FilterSearchContext> getSearchContexts()
WebContentFilter
getSearchContexts
in interface WebContentFilter
public WebContentFilter.FilterSearchContext addSearchContext()
WebContentFilter
addSearchContext
in interface WebContentFilter
protected WebContentFilter.FilterSearchContext createSeachContext()
public void setMaskOrphanContents(boolean mask)
WebContentFilter
setMaskOrphanContents
in interface WebContentFilter
mask
- true to mask orphan contentspublic boolean maskOrphanContents()
WebContentFilter
maskOrphanContents
in interface WebContentFilter
public WebContentFilter.AccessLimitation getAccessLimitation()
WebContentFilter
getAccessLimitation
in interface WebContentFilter
public void setAccessLimitation(WebContentFilter.AccessLimitation limitation)
WebContentFilter
setAccessLimitation
in interface WebContentFilter
limitation
- the access limitation policy to set.public AmetysObjectIterable<Content> getMatchingContents(String siteName, String lang, Page page)
WebContentFilter
ContentFilterHelper.isContentValid(org.ametys.cms.repository.Content, org.ametys.web.repository.page.Page, org.ametys.cms.filter.ContentFilter)
method.getMatchingContents
in interface WebContentFilter
siteName
- The current site name. Can be null.lang
- The current language. Can be null.page
- The current page. Can be null.ContentFilterHelper.isContentValid(Content, Page, ContentFilter)
protected AmetysObjectIterable<Content> getMatchingContents(String siteName, String lang, Page page, WebContentFilter.FilterSearchContext filterContext)
siteName
- the site name.lang
- the language.page
- the context page.filterContext
- the search context.public String getXPathQuery(String siteName, String lang, WebContentFilter.FilterSearchContext filterContext)
siteName
- The current site namelang
- The current languagefilterContext
- the filter search context.protected String getXPathQuery(String siteName, Page page, int depth, WebContentFilter.FilterSearchContext filterContext)
siteName
- The current site namepage
- The page where to start the searchdepth
- the search depthfilterContext
- the filter search context.protected Expression getFilterExpression(String siteName, WebContentFilter.FilterSearchContext filterContext)
siteName
- The current site namefilterContext
- the filter search context.