Class ImportTool

All Implemented Interfaces:
IChildEngine, ITool, IVariable, Serializable, Cloneable, Observer
Direct Known Subclasses:
DefaultImporterTool

@OpenApiAll public class ImportTool extends Tool implements Observer, IChildEngine
This tool will allow us to import Child-Templates at Velocity Runtime.
Since:
Dec 11, 2008
See Also:
  • Field Details

    • log

      public static org.apache.logging.log4j.Logger log
  • Constructor Details

    • ImportTool

      public ImportTool()
      Constructor.
  • Method Details

    • include

      public CharSequence include(Element element)
      This method will include all the content of a specific attached file element.
      Parameters:
      element - the attached element
      Returns:
      the correctly formated Text from the ChildTemplate
    • include

      public CharSequence include(String templateFileName)
      This method will include all the content of a child template.
      Parameters:
      templateFileName - the path of childTemplate
      Returns:
      the correctly formated Text from the ChildTemplate
    • include

      public CharSequence include(Element element, String section)
      This method will include the subSection of a specific attached file element.
      The ChildTemplate has to be formatted according to the already existing #sectionBegin and #sectionEnd directives.
      Parameters:
      element - the attached element
      section - the section to be included
      Returns:
      the correctly formated Section Text from the ChildTemplate
    • include

      public CharSequence include(String templateFileName, String section)
      This method will include the subSection of the ChildTemplate.
      The ChildTemplate has to be formatted according to the already existing #sectionBegin and #sectionEnd directives.
      Parameters:
      templateFileName - the path of childTemplate
      section - the section to be included
      Returns:
      the correctly formated Section Text from the ChildTemplate
    • includeSection

      public CharSequence includeSection(Element element, String section)
      This method will include the subSection of a specific attached file element.
      The ChildTemplate has to be formatted according to the already existing #sectionBegin and #sectionEnd directives.
      Parameters:
      element - the attached element
      section - the section to be included
      Returns:
      the correctly formated Section Text from the ChildTemplate
    • includeSection

      public CharSequence includeSection(String templateFileName, String section)
      This method will include the subSection of the ChildTemplate.
      The ChildTemplate has to be formatted according to the already existing #sectionBegin and #sectionEnd directives as introduced in MagicReport 14.0.
      Parameters:
      templateFileName - the path of childTemplate
      section - the section to be included
      Returns:
      the correctly formated Section Text from the ChildTemplate
    • importer

      public CharSequence importer(Element element, String section)
      Gets the String content of a specific attached file element. This will do all the importTool's work. It is called by both public methods, with the difference that section is null if we want to include the whole file. Else it has a section name and only that subsection will be included.
      Parameters:
      element - the attached element
      section - if there is a section else this is null
      Returns:
      the evaluated and validated output from childTemplate
    • importer

      public CharSequence importer(String templateFileName, String section)
      Gets the String content of a specific import file path. This will do all the importTool's work. It is called by both public methods, with the difference that section is null if we want to include the whole file. Else it has a section name and only that subsection will be included.
      Parameters:
      templateFileName - the path of childTemplate to be evaluated
      section - if there is a section else this is null
      Returns:
      the evaluated and validated output from childTemplate
    • fileImporter

      protected CharSequence fileImporter(Object template, String section)
      Gets the String content of the import. This will do all the importTool's work. It is called by both public methods, with the difference that section is null if we want to include the whole file. Else it has a section name and only that subsection will be included.
      Parameters:
      template - the template path or attached file
      section - if there is a section else this is null
      Returns:
      the evaluated and validated output from childTemplate
    • setupTool

      public void setupTool(DefaultImporterTool importerTool)
      Set required properties and observer to importer tool.
      Parameters:
      importerTool - current importer tool
    • update

      public void update(Observable o, Object arg)
      This method is called whenever the template engine is changed. An template engine calls an Observable object's notifyObservers method to have all the object's observers notified of the change.
      Specified by:
      update in interface Observer
      Parameters:
      o - the observable object
      arg - an argument passed to the notifyObservers method.
    • getParentEngine

      public ITemplateEngine getParentEngine()
      Description copied from interface: IChildEngine
      Get parent engine.
      Specified by:
      getParentEngine in interface IChildEngine
      Returns:
      parent engine
    • setParentEngine

      public void setParentEngine(ITemplateEngine parentEngine)
      Description copied from interface: IChildEngine
      Set parent engine.
      Specified by:
      setParentEngine in interface IChildEngine
      Parameters:
      parentEngine - parent engine
    • isParentSupportChild

      public boolean isParentSupportChild(String engineType)