Class QueryCollectingTreeProcessor

  • All Implemented Interfaces:
    org.asciidoctor.extension.Processor

    public class QueryCollectingTreeProcessor
    extends org.asciidoctor.extension.Treeprocessor
    Extension for Asciidoctor. Think of it as a listener: it is installed in the AsciiDoctor instance and gets pinged once for each file that is processed. It looks for two kinds of blocks in the AsciiDoc source: 1) Blocks with the role `setup-query` or 'graph-project-query' 2) Blocks with the role `query-example`. The content is expected to contain exactly two blocks: 2.1) First, a block containing a Cypher query example. 2.2) Second, a table containing a Cypher query result. Each block may have an attribute 'operator' if we want a certain user to execute the query Once you have called process(org.asciidoctor.ast.Document) you are then able to query this class for the before-all, before-each and actual example queries. Remember though, you should only harvest queries after the last document has been processed, or you will not get the right grouping.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<DocQuery> getBeforeAllQueries()  
      java.util.List<DocQuery> getBeforeEachQueries()  
      java.util.List<QueryExampleGroup> getQueryExampleGroups()
      Do grouping into QueryExampleGroups
      org.asciidoctor.ast.Document process​(org.asciidoctor.ast.Document document)
      This method is called once for each file loaded.
      • Methods inherited from class org.asciidoctor.extension.BaseProcessor

        createBlock, createBlock, createBlock, createBlock, createBlock, createBlock, createBlock, createDocument, createList, createList, createList, createListItem, createListItem, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createPhraseNode, createSection, createSection, createSection, createSection, createSection, createTable, createTable, createTableCell, createTableCell, createTableCell, createTableCell, createTableColumn, createTableColumn, createTableRow, getConfig, log, parseContent, setConfig, unwrap, updateConfig
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QueryCollectingTreeProcessor

        public QueryCollectingTreeProcessor()
    • Method Detail

      • process

        public org.asciidoctor.ast.Document process​(org.asciidoctor.ast.Document document)
        This method is called once for each file loaded. This affects grouping mainly. We collect the three types of queries from each file, and someone can harvest them all later.
        Specified by:
        process in class org.asciidoctor.extension.Treeprocessor
      • getBeforeAllQueries

        public java.util.List<DocQuery> getBeforeAllQueries()
      • getBeforeEachQueries

        public java.util.List<DocQuery> getBeforeEachQueries()
      • getQueryExampleGroups

        public java.util.List<QueryExampleGroup> getQueryExampleGroups()
        Do grouping into QueryExampleGroups