Class FileService

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    public class FileService
    extends ServiceConfig
    Manage application initialization
    • Constructor Detail

      • FileService

        public FileService​(BroadcastService broadcastService,
                           AweRequest request,
                           BaseConfigProperties baseConfigProperties,
                           EncodeService encodeService)
        Autowired constructor
        Parameters:
        broadcastService - Broadcaster
        request - Request
        baseConfigProperties - Base configuration properties
        encodeService - Encode service
    • Method Detail

      • getTextFile

        public org.springframework.http.ResponseEntity<String> getTextFile​(String path,
                                                                           String contentType)
                                                                    throws AWException
        Retrieve a text file content
        Parameters:
        path - File path
        contentType - Content type
        Returns:
        Text file
        Throws:
        AWException - Error retrieving text file
      • getLogFile

        public ServiceData getLogFile()
                               throws AWException
        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 path
        contentType - 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 data
        downloadIdentifier - 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 file
        folder - Destination folder
        Returns:
        File path
        Throws:
        AWException - Error retrieving text file
      • deleteFile

        public ServiceData deleteFile​(FileData fileData)
                               throws AWException
        Deletes an uploaded file
        Parameters:
        fileData - File data
        Returns:
        Service data
        Throws:
        AWException - Error deleting file
      • getFileInfo

        public ServiceData getFileInfo()
                                throws AWException
        Given a file identifier, retrieve file information
        Returns:
        File information
        Throws:
        AWException - Error generating file info
      • getFullPath

        public String getFullPath​(FileData fileData,
                                  boolean create)
        Retrieves a previously uploaded file from upload path
        Parameters:
        fileData - File data
        create - Create path
        Returns:
        Uploaded file path