Class GridFsRepository

java.lang.Object
org.qubership.atp.ram.repositories.GridFsRepository

@Repository("ram-gridfs-repository") public class GridFsRepository extends Object
  • Constructor Details

    • GridFsRepository

      public GridFsRepository()
  • Method Details

    • getAllFilesWhereMetadataLogRecordIdInList

      @NotNull public @NotNull List<ExtendedFileData> getAllFilesWhereMetadataLogRecordIdInList(List<UUID> logRecordsIds)
      This method retrieves screen shot fro GridFS system.
      Parameters:
      logRecordsIds - of steps, which for you would like get List of FileData
      Returns:
      Optional.empty() if ScreenShot not found for specified logRecordUuid or FileData if it present in database.
    • getFileData

      @Deprecated public Optional<FileData> getFileData(UUID logRecordUuid)
      Deprecated.
      This method retrieves all files from gridFs where metadata.logRecordUuid equals logRecordUuid
      Parameters:
      logRecordUuid - of step, which for you would like get FileData
      Returns:
      Optional.empty() if ScreenShot not found for specified logRecordUuid or FileData if it present in database.
    • getFileDataByFileName

      public Optional<FileData> getFileDataByFileName(UUID logRecordUuid, String filename)
      This method retrieves file from gridFs where metadata.logRecordUuid equals logRecordUuid and metadata.snapshotSource equals filename.
      Parameters:
      logRecordUuid - of step, which for you would like get FileData
      filename - file name
      Returns:
      Optional.empty() if ScreenShot not found for specified logRecordUuid or FileData if it present in database.
    • removeAttachment

      public void removeAttachment(List<UUID> logRecordsUuidList)
      Remove attachment.
      Parameters:
      logRecordsUuidList - of log record, for which will delete attachment
    • getCountScreen

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

      public String save(String type, String creationTime, String contentType, UUID id, InputStream fileInputStream, String fileName, String snapshotSource)
      Save screenshot.
    • save

      public String save(String type, String creationTime, String contentType, UUID logRecordUuid, UUID testRunId, InputStream fileInputStream, String fileName, String snapshotSource)
      Save file for log record.
      Parameters:
      type - type of file
      creationTime - time of creation
      contentType - type of content
      logRecordUuid - id of log record
      testRunId - id of test run
      fileInputStream - file
      fileName - name
      snapshotSource - source
      Returns:
      ObjectId of created file
    • save

      public String save(String fileName, String type, String contentType, InputStream fileInputStream, Map<String,Object> metadata)
      Upload file with specified filename, type, content type and metadata.
      Parameters:
      fileName - file name
      type - file type
      contentType - file content type
      fileInputStream - file input steam data
      metadata - metadata map
      Returns:
      uploaded file identifier
    • getReportById

      public GridFsFileData getReportById(UUID reportId) throws FileNotFoundException
      Get report by id.
      Parameters:
      reportId - report identifier
      Returns:
      file data
      Throws:
      FileNotFoundException
    • saveMandatoryChecksReport

      public void saveMandatoryChecksReport(UUID reportId, UUID executionRequestId, InputStream fileInputStream, String fileName)
      Save mandatory checks report.
    • deleteByUploadDate

      public void deleteByUploadDate(LocalDate checkedDate)
      Delete documents from gridfs by `filter` UPLOAD_DATE.