java.lang.Object
org.qubership.atp.mia.model.impl.generation.Template

public class Template extends Object
  • Constructor Details

    • Template

      public Template(MiaContext miaContext, MiaFileService miaFileService, String relativeEthalonPath, String rawOutputFileName, String fileExtension, Charset charset)
      Constructs a Template instance using the provided context and file parameters. This constructor resolves the full path to the ethalon file using the project base path, sanitizes the output file name to remove any path components, and builds the final output file name.
      Parameters:
      miaContext - context containing the base project path
      miaFileService - service used for file operations
      relativeEthalonPath - relative path to the ethalon file (may include subfolders)
      rawOutputFileName - name of the generated output file (should not include path)
      fileExtension - extension of the output file (e.g., ".csv")
      charset - character encoding to use; defaults to UTF-8 if null
  • Method Details

    • evaluateFile

      public void evaluateFile()
      Generates file from ethalon.
    • getContent

      public String getContent()
      Get content of the file.
      Returns:
      content of the file. If it null reads it first from Ethalon File Path.
    • evaluateContent

      public String evaluateContent(Map<String,String> additionalParams)
      Evaluate content of the file.
      Parameters:
      additionalParams - additionalParams to evaluate
      Returns:
      evaluated content
    • replaceContent

      public void replaceContent(String from, String to)
      Default single replace content operation. Uses replaceFirst function.
      Parameters:
      from - string to replace.
      to - string to substitute.
    • evaluateTemplate

      public void evaluateTemplate(Command command, CommonConfiguration commonConf, Map<String,String> params)
      Replaces EventParameter with EventTemplate in the content of template. Main purpose is to use in TestData operation for new line generation in control file.
      Parameters:
      command - which contains EventParameter and EventTemplate.
      commonConf - to get Variable format.
      params - for EventTemplate evaluation.
    • getFile

      public File getFile()
      Evaluates and generates file.
      Returns:
      generated file generatedFile
    • writeContent

      public void writeContent()
      Write content into file.
    • getFileName

      public String getFileName()
      Gets file name.
      Returns:
      outputFileName