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 manipulating ContentFilter
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • saxMatchingContents

      SAX all contents matching the given filter
      Parameters:
      handler - The content handler to SAX into
      filter - The filter
      Throws:
      SAXException - If an error occurs while SAXing
      IOException - 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 into
      filter - The filter
      siteName - 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 SAXing
      IOException - 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 filter
      siteName - 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 into
      content - The content to SAX
      viewName - The view to use
      checkUserAccess - Set to true to check FO user access when rendering content
      Throws:
      SAXException - If an error occurs while SAXing
      IOException - 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.
    • isOrphan

      protected boolean isOrphan(Content content)
      Determines if a content is orphan
      Parameters:
      content - the content to test
      Returns:
      true if the content is orphan