Package org.qubership.atp.mia.service
Class MiaContext
java.lang.Object
org.qubership.atp.mia.service.MiaContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateFileName(ContentType contentType) Creates filename for supported content type if content-dispostion not present in header.createLogFileName(String suffix, String extension) Creates log file name.createLogFileName(Command command) Creates log file name.createTableFileName(String tableName) Creates csv file name.Evaluate or replace macros in string.Evaluate or replace macros in string.evaluateTableMarker(TableMarker tableMarker) Evaluate or replace macros in table marker.evaluateWithMacroses(String text) Evaluates text with using of macroses.Get configuration using project ID from FlowData.Gets externalPrefix from properties file and update it with values fromFlowData.Get FlowData.static LinkgetLogLinkOnUi(String path) Gets path for display on UI.Gets path of project for log.POT template.Gets path of project for log.Get project ID from FlowData.getProjectPathWithType(ProjectFileType projectFileType) Gets path of project for files with needed type.getProjectPathWithType(ProjectFileType projectFileType, UUID sessionId) Gets path of project for files with needed type.getShellPrefixes(String system) Gets shell prefixes.Gets path of project for upload files.prepareMiaURL(String miaPath, String processName) Encodes MIA URL for response to ITF export.voidReplaces spaces to `_` to avoid error during bash processes.voidsetContext(UUID projectId, UUID sessionId) Set context by project ID and session ID.voidsetContext(ExecutionRequest request, UUID projectId, String environmentName) Set context by request, project ID and environment name.voidsetFlowDataFromRequest(ExecutionRequest request) It adds request parameters to flow data Parameters.zipCommandOutputs(String processName, List<String> filePaths) Zip all files from command output.zipCommandOutputs(List<String> filePaths, Path zipPath) Zip all files from command output.
-
Constructor Details
-
MiaContext
public MiaContext()
-
-
Method Details
-
getLogLinkOnUi
Gets path for display on UI.- Parameters:
path- path- Returns:
- path for display on UI
-
createFileName
Creates filename for supported content type if content-dispostion not present in header. -
createLogFileName
Creates log file name.- Parameters:
command- command- Returns:
- log file name
-
createLogFileName
Creates log file name.- Parameters:
suffix- suffix of the fileextension- extension of the file- Returns:
- log file name with extension
-
createTableFileName
Creates csv file name.- Parameters:
tableName- string- Returns:
- csv file name
-
evaluate
Evaluate or replace macros in string. -
evaluate
Evaluate or replace macros in string. -
evaluateTableMarker
Evaluate or replace macros in table marker. -
getConfig
Get configuration using project ID from FlowData.- Returns:
- ProjectConfiguration
-
getExternalPrefix
Gets externalPrefix from properties file and update it with values fromFlowData. -
getFlowData
Get FlowData.- Returns:
- FlowData
-
getLogPath
Gets path of project for log.- Returns:
- log path
-
getPotTemplate
POT template.- Returns:
- path to project
-
getProjectFilePath
Gets path of project for log.- Returns:
- log path
-
getProjectId
Get project ID from FlowData.- Returns:
- project ID
-
getProjectPathWithType
Gets path of project for files with needed type.- Parameters:
projectFileType- ProjectFileType- Returns:
- path
-
getProjectPathWithType
Gets path of project for files with needed type.- Parameters:
projectFileType- ProjectFileType- Returns:
- path
-
getShellPrefixes
Gets shell prefixes.- Returns:
- list of prefixes from application.properties
-
getUploadsPath
Gets path of project for upload files.- Returns:
- upload path
-
prepareMiaURL
Encodes MIA URL for response to ITF export.- Parameters:
miaPath- path to mia process.processName- name of the process.- Returns:
- prepared url to IFT response.
-
replaceSpacesInAccountNumber
public void replaceSpacesInAccountNumber()Replaces spaces to `_` to avoid error during bash processes. -
setContext
Set context by project ID and session ID.- Parameters:
projectId- project IDsessionId- session ID
-
setContext
Set context by request, project ID and environment name.- Parameters:
request- requestprojectId- project IDenvironmentName- environment name
-
setFlowDataFromRequest
It adds request parameters to flow data Parameters.- Parameters:
request- MIA Execution Request
-
zipCommandOutputs
Zip all files from command output. If file is directory or not present the empty file with error will be created. Generates output archive in Logs directory for current project id.- Parameters:
processName- name of executed processfilePaths- paths to zip files- Returns:
- link to generated archive
-
zipCommandOutputs
Zip all files from command output. If file is directory or not present the empty file with error will be created.- Parameters:
filePaths- paths to zip fileszipPath- path where to save resulting archive- Returns:
- link to generated archive
-
evaluateWithMacroses
Evaluates text with using of macroses.
-