Class AbstractDataExporter

    • Constructor Detail

      • AbstractDataExporter

        public AbstractDataExporter​(IModel<String> dataFormatNameModel,
                                    String contentType,
                                    String fileNameExtension)
        Creates a new instance with the data format name model, content type and file name extensions provided.
        Parameters:
        dataFormatNameModel - The model of the exported data format name.
        contentType - The MIME content type of the exported data type.
        fileNameExtension - The file name extensions to use in the file name for the exported data.
    • Method Detail

      • getContentType

        public String getContentType()
        Returns the MIME content type of the export data type. This could be something like "text/csv". This is used to provide the correct content type when downloading the exported data.
        Specified by:
        getContentType in interface IDataExporter
        Returns:
        the MIME content type of the export data type.
      • getFileNameExtension

        public String getFileNameExtension()
        Returns the file name extensions for the exported data, without the ".". For CSV, this should be "csv". For Excel exports, this should be "xls".
        Specified by:
        getFileNameExtension in interface IDataExporter
        Returns:
        the file name extensions for the exported data, without the ".".
      • setContentType

        public AbstractDataExporter setContentType​(String contentType)
        Sets the MIME contentType for the data export format.
        Parameters:
        contentType - The MIME contentType for the data export format.
        Returns:
        this, for chaining.
      • setFileNameExtension

        public AbstractDataExporter setFileNameExtension​(String fileNameExtension)
        Sets the file name extension to be used in the exported file name.
        Parameters:
        fileNameExtension - the file name extension to be used in the exported file name.
        Returns:
        this, for chaining.