Class ReportFileTool

All Implemented Interfaces:
ITool, IVariable, Serializable, Cloneable

@OpenApiAll public class ReportFileTool extends FileTool
See Also:
  • Field Details

  • Constructor Details

    • ReportFileTool

      public ReportFileTool(ITemplateEngine engine)
      Constructor
      Parameters:
      engine - template engine
  • Method Details

    • silentCreate

      public ITool.Void silentCreate(Element element) throws ParseErrorException
      A shortcut to create file from specific element.
      The output filename is same the extracted file name from attached element.

      For example:

          $file.silentCreate($anAttachedFileElement)
       
      Parameters:
      element - an AttachedFile element
      Returns:
      void
      Throws:
      ParseErrorException - when template has a syntax or other error which prevents it from being parsed.
    • silentCreate

      public ITool.Void silentCreate(Element element, Object importObject) throws ParseErrorException
      A shortcut to create file from specific element.
      The output filename is same the extracted file name from attached element.

      For example:

          $file.silentCreate($anAttachedFileElement,'')
       

      If importObject is an instance of java.util.Map, key-value of Map will be used as name-value of context.

      Parameters:
      element - an AttachedFile element
      importObject - the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.
      Returns:
      void
      Throws:
      ParseErrorException - when template has a syntax or other error which prevents it from being parsed.
    • silentCreate

      public ITool.Void silentCreate(Element element, String outputFileName, Object importObject) throws ParseErrorException
      Generate the report output from given attached file element.

      For example:

          $file.silentCreate($anAttachedFileElement,'overview.html','')
       

      If importObject is an instance of java.util.Map, key-value of Map will be used as name-value of context.

      Parameters:
      element - an AttachedFile element
      outputFileName - the output file name
      importObject - the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.
      Returns:
      void
      Throws:
      ParseErrorException - when template has a syntax or other error which prevents it from being parsed.
    • create

      public String create(Element element) throws ParseErrorException
      A shortcut to create file from specific element.
      The output filename is same the extracted file name from attached element.
      No import context object

      For example:

          <a href="$file.create($anAttachedFileElement)">attachedFile.html</a>
       
      Parameters:
      element - an AttachedFile element
      Returns:
      the output pathname. It will return empty string, if there is any error.
      Throws:
      ParseErrorException - when template has a syntax or other error which prevents it from being parsed.
    • create

      public String create(Element element, Object importObject) throws ParseErrorException
      A shortcut to create file from specific element.
      The output filename is same the extracted file name from attached element.

      For example:

          <a href="$file.create($anAttachedFileElement,'')">attachedFile.html</a>
       

      If importObject is an instance of java.util.Map, key-value of Map will be used as name-value of context.

      Parameters:
      element - an AttachedFile element
      importObject - the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.
      Returns:
      the output pathname. It will return empty string, if there is any error.
      Throws:
      ParseErrorException - when template has a syntax or other error which prevents it from being parsed.
    • create

      public String create(Element element, String outputFileName, Object importObject) throws ParseErrorException
      Generate the report output from given attached file element.

      For example:

          <a href="$file.create($anAttachedFileElement,'attachedFile.html','')">attachedFile.html</a>
       

      If importObject is an instance of java.util.Map, key-value of Map will be used as name-value of context.

      Parameters:
      element - an AttachedFile element
      outputFileName - the output file name
      importObject - the object reference, which will be DefaultElement in the template file. You can use DefaultElement variable in the template file for getting the data.
      Returns:
      the output pathname. It will return empty string, if there is any error.
      Throws:
      ParseErrorException - when template has a syntax or other error which prevents it from being parsed.
    • copy

      public String copy(Element element)
      Copy the file that is extracted from attached file element to output file in binary format.

      For example:

         <img src="$file.copy($anAttachedFileElement)">
       
      Parameters:
      element - an AttachedFile element
      Returns:
      the output pathname. It will return empty string, if there is any error.
    • copy

      public String copy(Element element, String outputFileName)
      Copy the file that is extracted from attached file element to output file in binary format.

      For example:

         <img src="$file.copy($anAttachedFileElement,'icon.gif')">
       
      Parameters:
      element - an AttachedFile element
      outputFileName - the output filename
      Returns:
      the output pathname. It will return empty string, if there is any error.
    • createAndWait

      public String createAndWait(Element element)
      Invoke a new template engine to generate a report and return the path to output file. The output report will be named by the extracted file from attached element.
      Parameters:
      element - an AttachedFile element
      Returns:
      an absolute path to output file.
    • createAndWait

      public String createAndWait(Element element, Object contextValue)
      Invoke a new template engine to generate a report and return the path to output file. The output report will be named by the extracted file from attached element.
      Parameters:
      element - an AttachedFile element
      contextValue - additional object adding to new template context with default $importer name.
      Returns:
      an absolute path to output file.
    • createAndWait

      public String createAndWait(Element element, String outputFileName, Object contextValue)
      Invoke a new template engine to generate a report and return the path to output file.

      "importer" will be used as a name of context value.

      Parameters:
      element - an AttachedFile element
      outputFileName - an output report file name.
      contextValue - additional object adding to new template context with default $importer name.
      Returns:
      an absolute path to output file.
    • createAndWait

      public String createAndWait(Element element, String outputFileName, String contextName, Object contextValue)
      Invoke a new template engine to generate a report and return the path to output file.
      Parameters:
      element - an AttachedFile element
      outputFileName - an output report file name.
      contextName - adding object context's name.
      contextValue - additional object adding to new template context.
      Returns:
      an absolute path to output file.
    • createAndWait

      public String createAndWait(Element element, Map<String,Object> context)
      Invoke a new template engine to generate a report and return the path to output file. The output report will be named by template file name.
      Parameters:
      context - additional context adding to new template.
      templateFile - an input template file.
      Returns:
      an absolute path to output file.
    • createAndWait

      public String createAndWait(Element element, String outputFileName, Map<String,Object> context)
      Invoke a new template engine to generate a report and return the path to output file.
      Parameters:
      element - an AttachedFile element
      outputFileName - an output report file name.
      context - additional context adding to new template.
      Returns:
      an absolute path to output file.