Class Template
java.lang.Object
org.qubership.atp.mia.model.impl.generation.Template
-
Constructor Summary
ConstructorsConstructorDescriptionTemplate(MiaContext miaContext, MiaFileService miaFileService, String relativeEthalonPath, String rawOutputFileName, String fileExtension, Charset charset) Constructs a Template instance using the provided context and file parameters. -
Method Summary
Modifier and TypeMethodDescriptionevaluateContent(Map<String, String> additionalParams) Evaluate content of the file.voidGenerates file from ethalon.voidevaluateTemplate(Command command, CommonConfiguration commonConf, Map<String, String> params) Replaces EventParameter with EventTemplate in the content of template.Get content of the file.getFile()Evaluates and generates file.Gets file name.voidreplaceContent(String from, String to) Default single replace content operation.voidWrite content into file.
-
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 pathmiaFileService- service used for file operationsrelativeEthalonPath- 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
Get content of the file.- Returns:
- content of the file. If it null reads it first from Ethalon File Path.
-
evaluateContent
Evaluate content of the file.- Parameters:
additionalParams- additionalParams to evaluate- Returns:
- evaluated content
-
replaceContent
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
Evaluates and generates file.- Returns:
- generated file generatedFile
-
writeContent
public void writeContent()Write content into file. -
getFileName
Gets file name.- Returns:
- outputFileName
-