Class ExportFormat

java.lang.Object
io.goobi.viewer.model.export.ExportFormat

public class ExportFormat extends Object
Describes one configurable search export format as defined in config_viewer.xml under <export><format>.

Two kinds of format are supported, distinguished by the presence of the xslt attribute:

  • XSLT-based (e.g. ris/endnote/bibtex): carries xslt, contentType and fileExtension attributes; the export is produced by applying the stylesheet to the Solr result XML.
  • Java field-mapped (e.g. excel/csv): carries a list of <field> child elements naming the Solr fields to export as columns; the export is produced by a built-in Java handler keyed by the format name.

Example configuration:


 <format name="bibtex" enabled="true" xslt="solr2bibtex.xsl"
         contentType="text/plain" fileExtension="bib" />
 <format name="csv" enabled="true">
     <field>PI_TOPSTRUCT</field>
     <field>MD_TITLE</field>
 </format>
 
  • Field Details

    • CONTENT_TYPE_XLSX

      public static final String CONTENT_TYPE_XLSX
      HTTP content type for XLSX (Excel) downloads.
      See Also:
    • CONTENT_TYPE_CSV

      public static final String CONTENT_TYPE_CSV
      HTTP content type for CSV downloads.
      See Also:
  • Constructor Details

    • ExportFormat

      public ExportFormat(String name, boolean enabled, String xslt, String contentType, String fileExtension, List<ExportFieldConfiguration> fields)
      Creates a new export format descriptor. For Java field-mapped formats (no xslt) the contentType and fileExtension are derived from the format name when not explicitly configured.
      Parameters:
      name - unique format identifier used in the REST path (e.g. "bibtex", "csv")
      enabled - whether this format is currently active
      xslt - file name of the XSLT stylesheet (e.g. "solr2bibtex.xsl"), or blank for Java formats
      contentType - HTTP content type for the response; may be blank to use a name-based default
      fileExtension - file extension for the download file; may be blank to use a name-based default
      fields - Solr field columns for Java field-mapped formats (may be null/empty for XSLT formats)
  • Method Details

    • isXsltBased

      public boolean isXsltBased()
      Returns:
      true if this format is produced by an XSLT stylesheet, false if it is a Java field-mapped format
    • getFields

      public List<ExportFieldConfiguration> getFields()
      Returns:
      the configured Solr field columns for Java field-mapped formats; empty for XSLT formats
    • getName

      public String getName()
      Returns:
      the unique format identifier (e.g. "bibtex", "endnote", "ris")
    • isEnabled

      public boolean isEnabled()
      Returns:
      true if this export format is enabled in the configuration
    • getXslt

      public String getXslt()
      Returns:
      the XSLT stylesheet file name used for the transformation
    • getContentType

      public String getContentType()
      Returns:
      the HTTP content type to set on the response (e.g. "application/xml")
    • getFileExtension

      public String getFileExtension()
      Returns:
      the file extension for the downloaded file (e.g. "xml", "bib", "ris")
    • toString

      public String toString()
      Overrides:
      toString in class Object