= CollectionContentsExporter
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPI to provide file export to table views.

== API

[source,java]
.CollectionContentsExporter.java
----
interface CollectionContentsExporter {
  void createExport(DataTable dataTable, File tempFile)     // <.>
  Blob exportToBlob(DataTable dataTable, String name)     // <.>
  CommonMimeType getMimeType()
  String getTitleLabel()     // <.>
  String getCssClass()     // <.>
  int orderOfAppearanceInUiDropdown()     // <.>
  boolean appliesTo(ObjectSpecification objectType)     // <.>
}
----

<.> xref:#createExport_DataTable_File[createExport(DataTable, File)]
+
--
Implementing exporters need to write given tabular data from xref:refguide:core:index/metamodel/tabular/simple/DataTable.adoc[DataTable] into the _File tempFile_ , which is provided by the framework for the duration of a single request cycle.
--
<.> xref:#exportToBlob_DataTable_String[exportToBlob(DataTable, String)]
+
--
Writes given tabular data into a xref:refguide:applib:index/value/Blob.adoc[Blob] of given name.
--
<.> xref:#getTitleLabel_[getTitleLabel()]
<.> xref:#getCssClass_[getCssClass()]
<.> xref:#orderOfAppearanceInUiDropdown_[orderOfAppearanceInUiDropdown()]
+
--
An ordinal, that governs the order of appearance in the UI dropdown.
--
<.> xref:#appliesTo_ObjectSpecification[appliesTo(ObjectSpecification)]
+
--
Whether this exporter applies to given _objectType_ . If `false` , this exporter is not provided to the end user.
--

== Members

[#createExport_DataTable_File]
=== createExport(DataTable, File)

Implementing exporters need to write given tabular data from xref:refguide:core:index/metamodel/tabular/simple/DataTable.adoc[DataTable] into the _File tempFile_ , which is provided by the framework for the duration of a single request cycle.

[#exportToBlob_DataTable_String]
=== exportToBlob(DataTable, String)

Writes given tabular data into a xref:refguide:applib:index/value/Blob.adoc[Blob] of given name.

[#getTitleLabel_]
=== getTitleLabel()

[#getCssClass_]
=== getCssClass()

[#orderOfAppearanceInUiDropdown_]
=== orderOfAppearanceInUiDropdown()

An ordinal, that governs the order of appearance in the UI dropdown.

* _1000..1999_ reserved for different table presentations
* _2000..2999_ reserved for different table exports

Lowest comes first.

[#appliesTo_ObjectSpecification]
=== appliesTo(ObjectSpecification)

Whether this exporter applies to given _objectType_ . If `false` , this exporter is not provided to the end user.
