Package org.ametys.web.filter
Class ContentFilterHelper
- java.lang.Object
-
- org.ametys.web.filter.ContentFilterHelper
-
- All Implemented Interfaces:
Component
,Serviceable
public class ContentFilterHelper extends Object implements Component, Serviceable
Component helper for manipulatingContentFilter
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
__LOGGER
Loggerprotected ContentAccessManager
_contentAccessManager
The content access manager.protected CurrentUserProvider
_currentUserProvider
The current user providerprotected RenderingContextHandler
_renderingContentHandler
The rendering context handler.private SourceResolver
_resolver
static String
ROLE
The Avalon Role
-
Constructor Summary
Constructors Constructor Description ContentFilterHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getMatchingContentIds(WebContentFilter filter, String siteName, String lang, Page page)
Get the ID of all contents matching the given filter.protected boolean
isAccessible(Content content, Page currentPage, WebContentFilter filter)
Test if the content is accessible in accordance with the filter's access limitation policy.boolean
isContentValid(Content content, Page currentPage, ContentFilter filter)
Test if the content is accessible in accordance with the filter options (mask orphans, access limitation policy, ...)protected boolean
isOrphan(Content content)
Determines if a content is orphanvoid
saxContent(ContentHandler handler, Content content, String viewName, boolean checkUserAccess)
SAX a content in its specific viewvoid
saxMatchingContents(ContentHandler handler, ContentFilter filter)
SAX all contents matching the given filtervoid
saxMatchingContents(ContentHandler handler, WebContentFilter filter, String siteName, String lang, Page page)
SAX all contents matching the given filtervoid
service(ServiceManager manager)
-
-
-
Field Detail
-
__LOGGER
protected static final org.slf4j.Logger __LOGGER
Logger
-
_contentAccessManager
protected ContentAccessManager _contentAccessManager
The content access manager.
-
_renderingContentHandler
protected RenderingContextHandler _renderingContentHandler
The rendering context handler.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_resolver
private SourceResolver _resolver
-
-
Constructor Detail
-
ContentFilterHelper
public ContentFilterHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
saxMatchingContents
public void saxMatchingContents(ContentHandler handler, ContentFilter filter) throws SAXException, IOException
SAX all contents matching the given filter- Parameters:
handler
- The content handler to SAX intofilter
- The filter- Throws:
SAXException
- If an error occurs while SAXingIOException
- If an error occurs while retrieving content.
-
saxMatchingContents
public void saxMatchingContents(ContentHandler handler, WebContentFilter filter, String siteName, String lang, Page page) throws SAXException, IOException
SAX all contents matching the given filter- Parameters:
handler
- The content handler to SAX intofilter
- The filtersiteName
- The current site name. Can be null.lang
- The current language. Can be null.page
- The current page. Can be null.- Throws:
SAXException
- If an error occurs while SAXingIOException
- If an error occurs while retrieving content.
-
getMatchingContentIds
public List<String> getMatchingContentIds(WebContentFilter filter, String siteName, String lang, Page page)
Get the ID of all contents matching the given filter. This method filters orphan contents and limits the results if necessary.- Parameters:
filter
- The filtersiteName
- The current site name. Can be null.lang
- The current language. Can be null.page
- The current page. Can be null.- Returns:
- a List of all content IDs.
-
saxContent
public void saxContent(ContentHandler handler, Content content, String viewName, boolean checkUserAccess) throws SAXException, IOException
SAX a content in its specific view- Parameters:
handler
- The content handler to SAX intocontent
- The content to SAXviewName
- The view to usecheckUserAccess
- Set to true to check FO user access when rendering content- Throws:
SAXException
- If an error occurs while SAXingIOException
- If an error occurs while retrieving content.
-
isContentValid
public boolean isContentValid(Content content, Page currentPage, ContentFilter filter)
Test if the content is accessible in accordance with the filter options (mask orphans, access limitation policy, ...)- Parameters:
content
- the content to test.currentPage
- the current page.filter
- the content filter.- Returns:
- true if the content is accessible, false otherwise.
-
isAccessible
protected boolean isAccessible(Content content, Page currentPage, WebContentFilter filter)
Test if the content is accessible in accordance with the filter's access limitation policy.- Parameters:
content
- the content to test.currentPage
- the current page.filter
- the web content filter.- Returns:
- true if the content is accessible, false otherwise.
-
-