Package io.goobi.viewer.model.export
Class ExportFormat
java.lang.Object
io.goobi.viewer.model.export.ExportFormat
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,contentTypeandfileExtensionattributes; 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 formatname.
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExportFormat(String name, boolean enabled, String xslt, String contentType, String fileExtension, List<ExportFieldConfiguration> fields) Creates a new export format descriptor. -
Method Summary
-
Field Details
-
CONTENT_TYPE_XLSX
HTTP content type for XLSX (Excel) downloads.- See Also:
-
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 (noxslt) thecontentTypeandfileExtensionare derived from the formatnamewhen not explicitly configured.- Parameters:
name- unique format identifier used in the REST path (e.g. "bibtex", "csv")enabled- whether this format is currently activexslt- file name of the XSLT stylesheet (e.g. "solr2bibtex.xsl"), or blank for Java formatscontentType- HTTP content type for the response; may be blank to use a name-based defaultfileExtension- file extension for the download file; may be blank to use a name-based defaultfields- 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
- Returns:
- the configured Solr field columns for Java field-mapped formats; empty for XSLT formats
-
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
- Returns:
- the XSLT stylesheet file name used for the transformation
-
getContentType
- Returns:
- the HTTP content type to set on the response (e.g. "application/xml")
-
getFileExtension
- Returns:
- the file extension for the downloaded file (e.g. "xml", "bib", "ris")
-
toString
-