net.sf.jasperreports.engine.export

## Class JRCsvMetadataExporter

- java.lang.Object
- - net.sf.jasperreports.engine.JRAbstractExporter<RC,C,WriterExporterOutput,E>
  - - net.sf.jasperreports.engine.export.JRAbstractCsvExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,JRCsvExporterContext>
    - - net.sf.jasperreports.engine.export.JRCsvMetadataExporter

- All Implemented Interfaces:
    JRExporter<ExporterInput,CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,WriterExporterOutput>, Exporter<ExporterInput,CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,WriterExporterOutput>

      public class JRCsvMetadataExporter
      extends JRAbstractCsvExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,JRCsvExporterContext>

  Exports a JasperReports document to CSV format based on the metadata provided.

  The exporter allows users to specify which columns should be included in the CSV export, what other value than the default should they contain and whether the values for some columns should be auto filled when they are empty or missing (e.g. value for group columns)
  Version:
    $Id: JRCsvMetadataExporter.java 6805 2014-01-10 12:42:19Z teodord $
  Author:
    Narcis Marcu (narcism@users.sourceforge.net)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `JRCsvMetadataExporter.ExporterContext`

    - ### Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter

      `JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<java.lang.String>` | `columnNames`
    `static java.lang.String` | `PROPERTY_COLUMN_NAME` Property specifying the name of the column that should appear in the CSV export.
    `static java.lang.String` | `PROPERTY_DATA` Property that specifies what value to associate with `PROPERTY_COLUMN_NAME`.
    `static java.lang.String` | `PROPERTY_REPEAT_VALUE` Property that specifies whether the value associated with `PROPERTY_COLUMN_NAME` should be repeated or not when it is missing.

    - ### Fields inherited from class net.sf.jasperreports.engine.export.JRAbstractCsvExporter

      `CSV_EXPORTER_KEY, CSV_EXPORTER_PROPERTIES_PREFIX, nature, writer`

    - ### Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter

      `allSelector, crtCompositeConfiguration, crtCompositeItemConfiguration, crtItem, dateFormatCache, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE, exporterConfiguration, exporterContext, exporterInput, exporterOutput, filter, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, styledTextUtil`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRCsvMetadataExporter()`
    `JRCsvMetadataExporter(JasperReportsContext jasperReportsContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `ensureOutput()`
    `protected void` | `exportPage(JRPrintPage page)`
    `protected java.lang.Class<CsvMetadataExporterConfiguration>` | `getConfigurationInterface()`
    `protected java.lang.Class<CsvMetadataReportConfiguration>` | `getItemConfigurationInterface()`
    `protected void` | `initExport()`
    `protected void` | `initReport()`
    `protected void` | `writeCurrentRow(java.util.Map<java.lang.String,java.lang.String> currentRow, java.util.Map<java.lang.String,java.lang.String> repeatedValues)` Writes the current row.
    `protected void` | `writeReportHeader()` Writes the delimiter-separated column names

    - ### Methods inherited from class net.sf.jasperreports.engine.export.JRAbstractCsvExporter

      `exportReport, exportReportToWriter, getExporterKey, getExporterPropertiesPrefix, getStyledText, prepareText`

    - ### Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter

      `createFilter, defaultParseNumber, ensureInput, ensureJasperReportsContext, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getCustomHandler, getDateCellValue, getDateFormat, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getParameter, getParameters, getPropertiesUtil, getReportContext, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperPrint, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContext`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROPERTY_COLUMN_NAME

          public static final java.lang.String PROPERTY_COLUMN_NAME

      Property specifying the name of the column that should appear in the CSV export. It must be one of the values in `CsvMetadataReportConfiguration.getColumnNames()`, if provided.
      See Also:
        `JRPropertiesUtil`, Constant Field Values

    - #### PROPERTY_REPEAT_VALUE

          public static final java.lang.String PROPERTY_REPEAT_VALUE

      Property that specifies whether the value associated with `PROPERTY_COLUMN_NAME` should be repeated or not when it is missing.

      The property itself defaults to `false`.

      See Also:
        `JRPropertiesUtil`, Constant Field Values

    - #### PROPERTY_DATA

          public static final java.lang.String PROPERTY_DATA

      Property that specifies what value to associate with `PROPERTY_COLUMN_NAME`.

      The property itself defaults to the text value of the report element that this property is assigned to.

      See Also:
        `JRPropertiesUtil`, Constant Field Values

    - #### columnNames

          protected java.util.List<java.lang.String> columnNames

  - ### Constructor Detail

    - #### JRCsvMetadataExporter

          public JRCsvMetadataExporter()

      See Also:
        `JRCsvMetadataExporter(JasperReportsContext)`

    - #### JRCsvMetadataExporter

          public JRCsvMetadataExporter(JasperReportsContext jasperReportsContext)

  - ### Method Detail

    - #### getConfigurationInterface

          protected java.lang.Class<CsvMetadataExporterConfiguration> getConfigurationInterface()

      Specified by:
        `getConfigurationInterface` in class `JRAbstractExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,WriterExporterOutput,JRCsvExporterContext>`

    - #### getItemConfigurationInterface

          protected java.lang.Class<CsvMetadataReportConfiguration> getItemConfigurationInterface()

      Specified by:
        `getItemConfigurationInterface` in class `JRAbstractExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,WriterExporterOutput,JRCsvExporterContext>`

    - #### ensureOutput

          protected void ensureOutput()

      Specified by:
        `ensureOutput` in class `JRAbstractExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,WriterExporterOutput,JRCsvExporterContext>`

    - #### exportPage

          protected void exportPage(JRPrintPage page)
                             throws java.io.IOException

      Specified by:
        `exportPage` in class `JRAbstractCsvExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,JRCsvExporterContext>`
      Throws:
        `java.io.IOException`

    - #### initExport

          protected void initExport()

      Overrides:
        `initExport` in class `JRAbstractCsvExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,JRCsvExporterContext>`

    - #### initReport

          protected void initReport()

      Overrides:
        `initReport` in class `JRAbstractCsvExporter<CsvMetadataReportConfiguration,CsvMetadataExporterConfiguration,JRCsvExporterContext>`

    - #### writeReportHeader

          protected void writeReportHeader()
                                    throws java.io.IOException

      Writes the delimiter-separated column names
      Throws:
        `java.io.IOException`

    - #### writeCurrentRow

          protected void writeCurrentRow(java.util.Map<java.lang.String,java.lang.String> currentRow,
                             java.util.Map<java.lang.String,java.lang.String> repeatedValues)
                                  throws java.io.IOException

      Writes the current row.

      If the row is empty, nothing is written. If the are columns for auto fill (with valid data), they will be set on the current row and the row will be written only if it was not originally empty. This prevents the export file from having rows just with auto filled data.

      Parameters:
        `currentRow` -
        `repeatedValues` -
      Throws:
        `java.io.IOException`

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com