Package org.ametys.web.filter
Class ContentFilterHelper
java.lang.Object
org.ametys.web.filter.ContentFilterHelper
- All Implemented Interfaces:
Component
,Serviceable
Component helper for manipulating
ContentFilter
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final Logger
Loggerprotected ContentAccessManager
The content access manager.protected CurrentUserProvider
The current user providerprotected RenderingContextHandler
The rendering context handler.static final String
The Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetMatchingContentIds
(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
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 Details
-
ROLE
The Avalon Role -
__LOGGER
Logger -
_contentAccessManager
The content access manager. -
_renderingContentHandler
The rendering context handler. -
_currentUserProvider
The current user provider
-
-
Constructor Details
-
ContentFilterHelper
public ContentFilterHelper()
-
-
Method Details
-
service
- 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
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
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.
-
isOrphan
Determines if a content is orphan- Parameters:
content
- the content to test- Returns:
- true if the content is orphan
-