Class TransformedBufferedDocumentContentHandler<Document extends TransformedBufferedDocument>

java.lang.Object
org.xml.sax.helpers.DefaultHandler
fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler<Document>
fr.opensagres.xdocreport.document.preprocessor.sax.TransformedBufferedDocumentContentHandler<Document>
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public abstract class TransformedBufferedDocumentContentHandler<Document extends TransformedBufferedDocument> extends BufferedDocumentContentHandler<Document>
Document transformed to manage lazy loop for row table and dynamic image.
  • Constructor Details

    • TransformedBufferedDocumentContentHandler

      protected TransformedBufferedDocumentContentHandler(String entryName, fr.opensagres.xdocreport.template.formatter.FieldsMetadata fieldsMetadata, fr.opensagres.xdocreport.template.formatter.IDocumentFormatter formater, Map<String,Object> sharedContext)
  • Method Details

    • doStartElement

      public boolean doStartElement(String uri, String localName, String name, Attributes attributes) throws SAXException
      Overrides:
      doStartElement in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>
      Throws:
      SAXException
    • flushCharacters

      protected void flushCharacters(String characters)
      Overrides:
      flushCharacters in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>
    • processRowIfNeeded

      public String processRowIfNeeded(String content)
    • processRowIfNeeded

      public String processRowIfNeeded(String content, boolean forceAsField)
      If a row parsing, replace fields name with well script to manage lazy loop for table row.
      Parameters:
      content -
      Returns:
    • getProcessRowResult

      public ProcessRowResult getProcessRowResult(String content, boolean forceAsField)
      If a row parsing, replace fields name with well script to manage lazy loop for table row.
      Parameters:
      content -
      Returns:
    • getSharedContext

      public Map<String,Object> getSharedContext()
    • hasSharedContext

      public boolean hasSharedContext()
    • getFieldsMetadata

      public fr.opensagres.xdocreport.template.formatter.FieldsMetadata getFieldsMetadata()
    • getFormatter

      public fr.opensagres.xdocreport.template.formatter.IDocumentFormatter getFormatter()
    • getDirectives

      public fr.opensagres.xdocreport.template.formatter.DirectivesStack getDirectives()
    • getBeforeTableToken

      protected String getBeforeTableToken()
      Returns the before table token.
      Returns:
    • getAfterTableToken

      protected String getAfterTableToken()
      Returns the after table token.
      Returns:
    • getBeforeRowToken

      protected String getBeforeRowToken()
      Returns the before row token.
      Returns:
    • getAfterRowToken

      protected String getAfterRowToken()
      Returns the after row token.
      Returns:
    • getBeforeTableCellToken

      protected String getBeforeTableCellToken()
      Returns the before row token.
      Returns:
    • getAfterTableCellToken

      protected String getAfterTableCellToken()
      Returns the after row token.
      Returns:
    • extractListDirectiveInfo

      public int extractListDirectiveInfo(String characters, boolean dontRemoveListDirectiveInfo)
    • extractListDirectiveInfo

      public int extractListDirectiveInfo(String characters)
    • isTable

      protected boolean isTable(String uri, String localName, String name)
      Returns true if current element is a table and false otherwise.
      Parameters:
      uri -
      localName -
      name -
      Returns:
    • getTableTableName

      protected abstract String getTableTableName()
    • getTableRowName

      protected abstract String getTableRowName()
    • getTableCellName

      protected abstract String getTableCellName()
    • isTableRow

      protected boolean isTableRow(String uri, String localName, String name)
      Returns true if current element is a table row and false otherwise.
      Parameters:
      uri -
      localName -
      name -
      Returns:
    • processScriptBefore

      public boolean processScriptBefore(String fieldName)
    • processScriptAfter

      public boolean processScriptAfter(String fieldName)
    • doEndElement

      public void doEndElement(String uri, String localName, String name) throws SAXException
      Overrides:
      doEndElement in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>
      Throws:
      SAXException
    • getFieldAsTextStyling

      public fr.opensagres.xdocreport.template.formatter.FieldMetadata getFieldAsTextStyling(String content)
    • registerBufferedElement

      public String registerBufferedElement(long variableIndex, BufferedElement element)
    • generateKey

      public static String generateKey(long variableIndex)
    • getVariableIndex

      public long getVariableIndex()
    • getEntryName

      public String getEntryName()
    • formatDirective

      public String formatDirective(String directive)
    • getStartNoParse

      public String getStartNoParse()
    • getEndNoParse

      public String getEndNoParse()
    • createDocument

      protected abstract Document createDocument()
      Overrides:
      createDocument in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>