Package com.almis.awe.service
Class FileService
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.FileService
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
Manage application initialization
-
Constructor Summary
ConstructorDescriptionFileService
(BroadcastService broadcastService, AweRequest request, BaseConfigProperties baseConfigProperties, EncodeService encodeService) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionDeletes an uploaded filedeleteFile
(FileData fileData) Deletes an uploaded fileorg.springframework.http.ResponseEntity<byte[]>
downloadFile
(FileData fileData, Integer downloadIdentifier) Retrieve a text file contentGiven a file identifier, retrieve file informationorg.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource>
getFileStream
(FileData fileData) Retrieve a file contentorg.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource>
getFileStream
(String path, String contentType) Retrieve a text file contentgetFullPath
(FileData fileData, boolean create) Retrieves a previously uploaded file from upload pathRetrieve a log file contentorg.springframework.http.ResponseEntity<String>
getTextFile
(String path, String contentType) Retrieve a text file contentuploadFile
(org.springframework.web.multipart.MultipartFile file, String folder) Retrieve a text file contentMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
Constructor Details
-
FileService
public FileService(BroadcastService broadcastService, AweRequest request, BaseConfigProperties baseConfigProperties, EncodeService encodeService) Autowired constructor- Parameters:
broadcastService
- Broadcasterrequest
- RequestbaseConfigProperties
- Base configuration propertiesencodeService
- Encode service
-
-
Method Details
-
getTextFile
public org.springframework.http.ResponseEntity<String> getTextFile(String path, String contentType) throws AWException Retrieve a text file content- Parameters:
path
- File pathcontentType
- Content type- Returns:
- Text file
- Throws:
AWException
- Error retrieving text file
-
getLogFile
Retrieve a log file content- Returns:
- Service data with log value
- Throws:
AWException
- Error retrieving log file
-
getFileStream
public org.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource> getFileStream(String path, String contentType) throws AWException Retrieve a text file content- Parameters:
path
- File pathcontentType
- Content type- Returns:
- Text file
- Throws:
AWException
- Error retrieving text file
-
getFileStream
public org.springframework.http.ResponseEntity<org.springframework.core.io.FileSystemResource> getFileStream(FileData fileData) throws AWException Retrieve a file content- Parameters:
fileData
- File data- Returns:
- Text file
- Throws:
AWException
- Error retrieving text file
-
downloadFile
public org.springframework.http.ResponseEntity<byte[]> downloadFile(FileData fileData, Integer downloadIdentifier) throws AWException Retrieve a text file content- Parameters:
fileData
- File datadownloadIdentifier
- Download identifier- Returns:
- File to download
- Throws:
AWException
- Error retrieving text file
-
uploadFile
public FileData uploadFile(org.springframework.web.multipart.MultipartFile file, String folder) throws AWException Retrieve a text file content- Parameters:
file
- Uploaded filefolder
- Destination folder- Returns:
- File path
- Throws:
AWException
- Error retrieving text file
-
deleteFile
Deletes an uploaded file- Returns:
- Service data
- Throws:
AWException
- Error deleting file
-
deleteFile
Deletes an uploaded file- Parameters:
fileData
- File data- Returns:
- Service data
- Throws:
AWException
- Error deleting file
-
getFileInfo
Given a file identifier, retrieve file information- Returns:
- File information
- Throws:
AWException
- Error generating file info
-
getFullPath
Retrieves a previously uploaded file from upload path- Parameters:
fileData
- File datacreate
- Create path- Returns:
- Uploaded file path
-