Class GridFsService

java.lang.Object
org.qubership.atp.ram.services.GridFsService

@Service public class GridFsService extends Object
  • Constructor Details

  • Method Details

    • getScreenShot

      public SourceShot getScreenShot(UUID logRecordId)
      Method gets screenshot or snapshot from GridFs, thru GridFsRepository.getFileData(UUID) ScreenShot as Base64 or Snapshot in case it present in database.
      Parameters:
      logRecordId - of step, which for you would like get ScreenShot
      Returns:
      empty string if ScreenShot/Snapshot isn't present in db. Else - ScreenShot as Base64 or Snapshot
    • downloadFile

      public FileData downloadFile(UUID logRecordId)
      Find file in storage and return its data.
      Parameters:
      logRecordId - if of logRecord
      Returns:
      data of the file
    • downloadFileIntoString

      public String downloadFileIntoString(UUID logRecordId)
      Find file in storage and return its data as string.
      Parameters:
      logRecordId - related with file
      Returns:
      data of the file as string
    • downloadFileByName

      public FileData downloadFileByName(UUID logRecordId, String filename)
      Find file in storage and return its data.
      Parameters:
      logRecordId - if of logRecord
      Returns:
      data of the file
    • downloadFileIntoStringByName

      public String downloadFileIntoStringByName(UUID logRecordId, String filename)
      Find file in storage and return its data as string.
      Parameters:
      logRecordId - if of logRecord
      Returns:
      data of the file as string
    • downloadFilesByLogRecords

      public List<ExtendedFileData> downloadFilesByLogRecords(List<LogRecord> logRecords)
    • removeFilesByRecordUuidList

      public void removeFilesByRecordUuidList(List<UUID> logRecordUuidList)
    • save

      public String save(String image, String creationTime, String contentType, UUID logRecordId, InputStream inputStream, String fileName, String snapshotSource)
    • save

      public String save(String type, String creationTime, String contentType, UUID logRecordId, String content, String fileName)
      Store string content in gridFs repository.
      Parameters:
      type - Source type.
      creationTime - Save date.
      contentType - Source content type.
      logRecordId - LogRecord id.
      content - Stored content..
      fileName - File name.
      Returns:
      File id.
    • save

      public String save(String type, String creationTime, String contentType, UUID logRecordId, UUID testRunId, String content, String fileName)
      Store string content in gridFs repository.
      Parameters:
      type - Source type
      creationTime - Save date
      contentType - Source content type
      logRecordId - LogRecord id
      testRunId - TestRun id
      content - Stored content
      fileName - File name
      Returns:
      String object id of created file.
    • getReportById

      public GridFsFileData getReportById(UUID reportId) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • saveMandatoryChecksReport

      public void saveMandatoryChecksReport(UUID reportId, UUID executionRequestId, InputStream fileInputStream, String fileName)
      Save mandatory checks report.
      Parameters:
      executionRequestId - execution request identifier
      fileInputStream - file input stream
      fileName - file name
    • getCountScreen

      public int getCountScreen(List<LogRecord> logRecords)
      Get count of screenshots for TR.
      Parameters:
      logRecords - all LogRecords from TR.
      Returns:
      count of screenshots.
    • deleteExpiredFiles

      public void deleteExpiredFiles()
      Delete files which created earlier than expired period.
    • saveSsmMetricReport

      public UUID saveSsmMetricReport(String fileName, String type, String contentType, InputStream inputStream, UUID executionRequestId, UUID logRecordId)
      Upload SSM metrics report file into GridFS storage.