Class ItfLiteFileService
java.lang.Object
org.qubership.atp.itf.lite.backend.service.ItfLiteFileService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyFileForCopiedRequest(UUID oldRequestId, Date modifiedWhen, UUID newRequestId, Path folder) Copy file for new copied request.Optional<org.springframework.web.multipart.MultipartFile> getFileAsMultipartFileByRequestId(UUID requestId, Date modifiedWhen, Path folder) Get binary file asMultipartFilefrom cache or gridfs by request id.getFileDataById(UUID fileId, Date modifiedWhen, Path folder) Get binary file asFileDatafrom cache or gridfs by request id.getRequestFileData(UUID requestId, Date modifiedWhen, Path folder) Get binary file asFileDatafrom cache or gridfs by request id.getRequestPathToFile(UUID requestId, Date modifiedWhen, Path folder) Get path to file in file system by request id.getRequestPathToFileById(UUID fileId, Date modifiedWhen, Path folder) Get path to file in file system by request id.byte[]resolveParametersInMultipartFile(org.springframework.web.multipart.MultipartFile file, SaveRequestResolvingContext resolvingContext) Resolve parameters in multipart file body.uploadFileForRequest(UUID requestId, Path folder, org.springframework.web.multipart.MultipartFile file) Upload file to gridfs and file system by request id.
-
Constructor Details
-
ItfLiteFileService
public ItfLiteFileService()
-
-
Method Details
-
getRequestFileData
public FileData getRequestFileData(UUID requestId, Date modifiedWhen, Path folder) throws IOException Get binary file asFileDatafrom cache or gridfs by request id.- Parameters:
requestId- request id.modifiedWhen- request modified date.folder- path to folder.- Returns:
FileDatawith content and file name.- Throws:
IOException
-
getFileDataById
Get binary file asFileDatafrom cache or gridfs by request id.- Parameters:
fileId- file id.modifiedWhen- request modified date.folder- path to folder.- Returns:
FileDatawith 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 asMultipartFilefrom 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
-