Class ItfLiteFileService

java.lang.Object
org.qubership.atp.itf.lite.backend.service.ItfLiteFileService

@Service public class ItfLiteFileService extends Object
  • Constructor Details

    • ItfLiteFileService

      public ItfLiteFileService()
  • Method Details

    • getRequestFileData

      public FileData getRequestFileData(UUID requestId, Date modifiedWhen, Path folder) throws IOException
      Get binary file as FileData from cache or gridfs by request id.
      Parameters:
      requestId - request id.
      modifiedWhen - request modified date.
      folder - path to folder.
      Returns:
      FileData with content and file name.
      Throws:
      IOException
    • getFileDataById

      public FileData getFileDataById(UUID fileId, Date modifiedWhen, Path folder) throws IOException
      Get binary file as FileData from cache or gridfs by request id.
      Parameters:
      fileId - file id.
      modifiedWhen - request modified date.
      folder - path to folder.
      Returns:
      FileData with content and file name.
      Throws:
      IOException
    • resolveParametersInMultipartFile

      @Nullable public byte[] resolveParametersInMultipartFile(org.springframework.web.multipart.MultipartFile file, SaveRequestResolvingContext resolvingContext)
      Resolve parameters in multipart file body.
      Parameters:
      file - Multipart file.
      resolvingContext - context.
      Returns:
      array of bytes.
    • getFileAsMultipartFileByRequestId

      public Optional<org.springframework.web.multipart.MultipartFile> getFileAsMultipartFileByRequestId(UUID requestId, Date modifiedWhen, Path folder) throws IOException
      Get binary file as MultipartFile from cache or gridfs by request id.
      Parameters:
      requestId - request id.
      modifiedWhen - request modified date.
      folder - path to folder.
      Returns:
      MultipartFile
      Throws:
      IOException
    • getRequestPathToFile

      public Optional<Path> getRequestPathToFile(UUID requestId, Date modifiedWhen, Path folder) throws IOException
      Get path to file in file system by request id.
      Parameters:
      requestId - request id.
      modifiedWhen - request modified date.
      folder - path to folder.
      Returns:
      MultipartFile
      Throws:
      IOException
    • getRequestPathToFileById

      public Optional<Path> getRequestPathToFileById(UUID fileId, Date modifiedWhen, Path folder) throws IOException
      Get path to file in file system by request id.
      Parameters:
      fileId - file id.
      modifiedWhen - request modified date.
      folder - path to folder.
      Returns:
      MultipartFile
      Throws:
      IOException
    • copyFileForCopiedRequest

      public Optional<FileBody> copyFileForCopiedRequest(UUID oldRequestId, Date modifiedWhen, UUID newRequestId, Path folder) throws IOException
      Copy file for new copied request.
      Parameters:
      oldRequestId - old request id.
      modifiedWhen - modification date fot old request.
      newRequestId - id for new saved request.
      folder - path to folder with files.
      Throws:
      IOException
    • uploadFileForRequest

      public FileBody uploadFileForRequest(UUID requestId, Path folder, org.springframework.web.multipart.MultipartFile file) throws IOException
      Upload file to gridfs and file system by request id.
      Parameters:
      requestId - request id.
      folder - files directory.
      file - file for upload.
      Throws:
      IOException