Class MiaContext

java.lang.Object
org.qubership.atp.mia.service.MiaContext

@Service public class MiaContext extends Object
  • Constructor Details

    • MiaContext

      public MiaContext()
  • Method Details

    • getLogLinkOnUi

      public static Link getLogLinkOnUi(String path)
      Gets path for display on UI.
      Parameters:
      path - path
      Returns:
      path for display on UI
    • createFileName

      public String createFileName(ContentType contentType)
      Creates filename for supported content type if content-dispostion not present in header.
    • createLogFileName

      public String createLogFileName(Command command)
      Creates log file name.
      Parameters:
      command - command
      Returns:
      log file name
    • createLogFileName

      public String createLogFileName(String suffix, String extension)
      Creates log file name.
      Parameters:
      suffix - suffix of the file
      extension - extension of the file
      Returns:
      log file name with extension
    • createTableFileName

      public String createTableFileName(String tableName)
      Creates csv file name.
      Parameters:
      tableName - string
      Returns:
      csv file name
    • evaluate

      public String evaluate(String text)
      Evaluate or replace macros in string.
    • evaluate

      public String evaluate(String text, Map<String,String> additionalParameters)
      Evaluate or replace macros in string.
    • evaluateTableMarker

      public TableMarker evaluateTableMarker(TableMarker tableMarker)
      Evaluate or replace macros in table marker.
    • getConfig

      public ProjectConfiguration getConfig()
      Get configuration using project ID from FlowData.
      Returns:
      ProjectConfiguration
    • getExternalPrefix

      public String getExternalPrefix()
      Gets externalPrefix from properties file and update it with values from FlowData.
    • getFlowData

      public FlowData getFlowData()
      Get FlowData.
      Returns:
      FlowData
    • getLogPath

      public Path getLogPath()
      Gets path of project for log.
      Returns:
      log path
    • getPotTemplate

      public File getPotTemplate()
      POT template.
      Returns:
      path to project
    • getProjectFilePath

      public Path getProjectFilePath()
      Gets path of project for log.
      Returns:
      log path
    • getProjectId

      public UUID getProjectId()
      Get project ID from FlowData.
      Returns:
      project ID
    • getProjectPathWithType

      public Path getProjectPathWithType(ProjectFileType projectFileType)
      Gets path of project for files with needed type.
      Parameters:
      projectFileType - ProjectFileType
      Returns:
      path
    • getProjectPathWithType

      public Path getProjectPathWithType(ProjectFileType projectFileType, UUID sessionId)
      Gets path of project for files with needed type.
      Parameters:
      projectFileType - ProjectFileType
      Returns:
      path
    • getShellPrefixes

      public LinkedHashMap<String,String> getShellPrefixes(String system)
      Gets shell prefixes.
      Returns:
      list of prefixes from application.properties
    • getUploadsPath

      public Path getUploadsPath()
      Gets path of project for upload files.
      Returns:
      upload path
    • prepareMiaURL

      public String prepareMiaURL(String miaPath, String processName)
      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

      public void setContext(UUID projectId, UUID sessionId)
      Set context by project ID and session ID.
      Parameters:
      projectId - project ID
      sessionId - session ID
    • setContext

      public void setContext(ExecutionRequest request, UUID projectId, String environmentName)
      Set context by request, project ID and environment name.
      Parameters:
      request - request
      projectId - project ID
      environmentName - environment name
    • setFlowDataFromRequest

      public void setFlowDataFromRequest(ExecutionRequest request)
      It adds request parameters to flow data Parameters.
      Parameters:
      request - MIA Execution Request
    • zipCommandOutputs

      public Link zipCommandOutputs(String processName, List<String> filePaths)
      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 process
      filePaths - paths to zip files
      Returns:
      link to generated archive
    • zipCommandOutputs

      public Link zipCommandOutputs(List<String> filePaths, Path zipPath)
      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 files
      zipPath - path where to save resulting archive
      Returns:
      link to generated archive
    • evaluateWithMacroses

      public String evaluateWithMacroses(String text)
      Evaluates text with using of macroses.