Class GridFsService

java.lang.Object
org.qubership.atp.mia.service.file.GridFsService

@Service public class GridFsService extends Object
  • Constructor Details

    • GridFsService

      public GridFsService()
  • Method Details

    • cleanDb

      public void cleanDb()
      Clean GridFs from old files.
    • cleanMongoProjectFiles

      public void cleanMongoProjectFiles(UUID projectId, List<String> excludeIds)
      Clean mongo ProjectFiles.
      Parameters:
      projectId - projectId
      excludeIds - excludeIds
    • cleanLogs

      public void cleanLogs(Integer cleanInterval)
      Clean folder with logs.
      Parameters:
      cleanInterval - clean interval
    • deleteProjectFile

      public void deleteProjectFile(ProjectFile projectFile)
      Upload file to GridFs.
      Parameters:
      projectFile - project file
    • existFile

      public boolean existFile(ProjectFile projectFile)
      Check if file exist.
      Parameters:
      projectFile - ProjectFile.
    • getCollectionsSize

      public String getCollectionsSize()
      Returns collections size in selected bucket.
      Returns:
      size in megabytes.
    • rename

      public void rename(ProjectFile projectFile)
      Rename file.
    • restoreFile

      public void restoreFile(File file)
      Restore file from GridFs.
      Parameters:
      file - file.
    • getFile

      public Optional<com.mongodb.client.gridfs.model.GridFSFile> getFile(String gridFsObjectId)
    • saveLogResponseAfterExecution

      public void saveLogResponseAfterExecution(ExecutionResponse response)
      Save all file of response in GridFs.
      Parameters:
      response - execution response.
    • uploadFile

      public org.bson.types.ObjectId uploadFile(FileMetaData fileMetaData, String fullPathToFile)
      Upload file to GridFs.
      Parameters:
      fileMetaData - fileMetaData
      Returns:
      ObjectId of file in GridFs.
    • uploadFile

      public org.bson.types.ObjectId uploadFile(FileMetaData fileMetaData, File fullPathToFile)
      Upload file to GridFs.
      Parameters:
      fileMetaData - fileMetaData
      Returns:
      ObjectId of file in GridFs.
    • getByteArrayFromGridFsFile

      public byte[] getByteArrayFromGridFsFile(com.mongodb.client.gridfs.model.GridFSFile file)