java.lang.Object
org.ametys.web.frontoffice.search.metamodel.impl.ResourceSaxer
All Implemented Interfaces:
ReturnableSaxer

public class ResourceSaxer extends Object implements ReturnableSaxer
  • Field Details

  • Constructor Details

    • ResourceSaxer

      public ResourceSaxer(ResourceReturnable resourceReturnable)
      Constructor
      Parameters:
      resourceReturnable - The associated returnable on resources
  • Method Details

    • canSax

      public boolean canSax(AmetysObject hit, Logger logger, SearchComponentArguments args)
      Description copied from interface: ReturnableSaxer
      Returns true if this saxer is able to SAX the given search hit
      Specified by:
      canSax in interface ReturnableSaxer
      Parameters:
      hit - The search hit
      logger - A logger
      args - The other arguments
      Returns:
      true if this saxer is able to SAX the given search hit
    • sax

      public void sax(ContentHandler contentHandler, AmetysObject hit, Logger logger, SearchComponentArguments args) throws SAXException
      Description copied from interface: ReturnableSaxer
      SAX the given search hit
      Specified by:
      sax in interface ReturnableSaxer
      Parameters:
      contentHandler - The content handler
      hit - The search hit
      logger - A logger
      args - The other arguments
      Throws:
      SAXException - if a SAX error occured
    • _getResourceExcerpt

      protected String _getResourceExcerpt(Resource resource, Logger logger)
      Get the excerpt of the resource
      Parameters:
      resource - the resource
      logger - the logger to use in case of error
      Returns:
      the resource excerpt
    • _getResourcePage

      protected Page _getResourcePage(Resource resource)
      Get the page containing the resource
      Parameters:
      resource - the resource
      Returns:
      the page containing the resource, null if the resource is not inside a page
    • _getResourceContent

      protected Content _getResourceContent(Resource resource)
      Get the content containing the resource
      Parameters:
      resource - the resource
      Returns:
      the content containing the resource, null if the resource is not inside a content
    • _saxUri

      protected void _saxUri(ContentHandler contentHandler, Resource resource, Page page, Content content) throws SAXException
      Sax the resource URI
      Parameters:
      contentHandler - the content handler where to SAX into.
      resource - the resource used to resolve the URI
      page - the page used to resolve the URI
      content - the content used to resolve the URI
      Throws:
      SAXException - if an errors occurs during the value writing
    • _saxSize

      protected void _saxSize(ContentHandler contentHandler, long size) throws SAXException
      Sax the resource size
      Parameters:
      contentHandler - the content handler where to SAX into.
      size - the size to sax
      Throws:
      SAXException - if an errors occurs during the value writing
    • _saxIcon

      protected void _saxIcon(ContentHandler contentHandler, String filename) throws SAXException
      Sax the resource icon
      Parameters:
      contentHandler - the content handler where to SAX into.
      filename - the name of the resource
      Throws:
      SAXException - if an errors occurs during the value writing