com.jalios.jcms.stat
Class CSVExportRawDataHandler

java.lang.Object
  extended by com.jalios.jcms.stat.RawDataExportHandler
      extended by com.jalios.jcms.stat.CSVExportRawDataHandler
All Implemented Interfaces:
Cloneable

public class CSVExportRawDataHandler
extends RawDataExportHandler

implementation of RawDataExportHandler to generate CSV file

Since:
JCMS 6.3
Author:
Ludovic SMADJA

Field Summary
static char DEFAULT_TEXT_QUALIFER
           
static String REVISION
           
protected  com.csvreader.CsvWriter writer
           
 
Fields inherited from class com.jalios.jcms.stat.RawDataExportHandler
key, out, realOutput, useCompressStream, userLang
 
Constructor Summary
CSVExportRawDataHandler()
           
 
Method Summary
 Object clone()
           
 String convertField(String name, Class<?> clazz, Set<?> valueSet, String extraFieldName, String userLang)
          convert field to handler data
 List<String> duplicateHeader(String name, Class<?> clazz)
          indicate if a field have other representation (like member have id and also a name)
 void end(OutputStream out)
          Process end of export (after any write)
 void exportFooter(OutputStream out, String[] columnNames)
          export footer of data
 void exportHeader(OutputStream out, String[] columnNames)
          Export header of data
 void exportLine(OutputStream out, String[] dataArray)
          Export a line of data
 String getAvailableCsvConfigurationEscapeMode()
           
 Charset getCharset()
           
 String getCharsetName()
           
 String getConfigurationFragmentPath()
          indicates the path of the jsp fragment with driver configuration fields
 String getContentType()
           
 int getCsvConfigurationEscapeMode()
           
 String getCsvConfigurationFieldSeparator()
           
 String getCsvConfigurationTextQualifier()
           
 String getFileExtension()
           
 void init(OutputStream out)
          Initialise the handler (before any write)
 void setCharset(String value)
           
 void setCsvConfigurationEscapeMode(String csvConfigurationEscapeMode)
           
 void setCsvConfigurationFieldSeparator(String value)
           
 void setCsvConfigurationTextQualifier(String csvConfigurationTextQualifier)
           
 void setParameters(JcmsContext jspContext)
          update handler from parameters form
 boolean validateParameters(JcmsContext context)
          validate current parameter.
 
Methods inherited from class com.jalios.jcms.stat.RawDataExportHandler
getKey, getOut, getUserLang, isUseCompressStream, setKey, setOut, setUseCompressStream, setUserLang
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

DEFAULT_TEXT_QUALIFER

public static char DEFAULT_TEXT_QUALIFER

writer

protected com.csvreader.CsvWriter writer
Constructor Detail

CSVExportRawDataHandler

public CSVExportRawDataHandler()
Method Detail

getConfigurationFragmentPath

public String getConfigurationFragmentPath()
Description copied from class: RawDataExportHandler
indicates the path of the jsp fragment with driver configuration fields

Specified by:
getConfigurationFragmentPath in class RawDataExportHandler
Returns:
the fragment path

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class RawDataExportHandler
Throws:
CloneNotSupportedException

getCharset

public Charset getCharset()

getCharsetName

public String getCharsetName()

setCharset

public void setCharset(String value)

getCsvConfigurationFieldSeparator

public String getCsvConfigurationFieldSeparator()

setCsvConfigurationFieldSeparator

public void setCsvConfigurationFieldSeparator(String value)

getCsvConfigurationEscapeMode

public int getCsvConfigurationEscapeMode()

getAvailableCsvConfigurationEscapeMode

public String getAvailableCsvConfigurationEscapeMode()

setCsvConfigurationEscapeMode

public void setCsvConfigurationEscapeMode(String csvConfigurationEscapeMode)

getCsvConfigurationTextQualifier

public String getCsvConfigurationTextQualifier()

setCsvConfigurationTextQualifier

public void setCsvConfigurationTextQualifier(String csvConfigurationTextQualifier)

setParameters

public void setParameters(JcmsContext jspContext)
Description copied from class: RawDataExportHandler
update handler from parameters form

Overrides:
setParameters in class RawDataExportHandler
Parameters:
jspContext - the current JcmsContext

validateParameters

public boolean validateParameters(JcmsContext context)
Description copied from class: RawDataExportHandler
validate current parameter.

Overrides:
validateParameters in class RawDataExportHandler
Parameters:
context - the JcmsContext
Returns:
true if parameters are valid, false otherwise

exportFooter

public void exportFooter(OutputStream out,
                         String[] columnNames)
Description copied from class: RawDataExportHandler
export footer of data

Specified by:
exportFooter in class RawDataExportHandler
Parameters:
out - outputstream associated to this handler
columnNames - footer data

exportHeader

public void exportHeader(OutputStream out,
                         String[] columnNames)
                  throws IOException
Description copied from class: RawDataExportHandler
Export header of data

Specified by:
exportHeader in class RawDataExportHandler
Parameters:
out - outputstream associated to this handler
columnNames - the names of columns
Throws:
IOException

exportLine

public void exportLine(OutputStream out,
                       String[] dataArray)
                throws IOException
Description copied from class: RawDataExportHandler
Export a line of data

Specified by:
exportLine in class RawDataExportHandler
Parameters:
out - outputstream associated to this handler
dataArray - the data array
Throws:
IOException

init

public void init(OutputStream out)
Description copied from class: RawDataExportHandler
Initialise the handler (before any write)

Specified by:
init in class RawDataExportHandler
Parameters:
out - outputstream associated to this handler

end

public void end(OutputStream out)
Description copied from class: RawDataExportHandler
Process end of export (after any write)

Specified by:
end in class RawDataExportHandler
Parameters:
out - outputstream associated to this handler

convertField

public String convertField(String name,
                           Class<?> clazz,
                           Set<?> valueSet,
                           String extraFieldName,
                           String userLang)
Description copied from class: RawDataExportHandler
convert field to handler data

Specified by:
convertField in class RawDataExportHandler
Parameters:
name - the name of the field (see StatEntry.STAT_FIELDS)
clazz - the class of the field (see StatEntry.STAT_FIELDS_CLASS)
valueSet - the Set of value
extraFieldName - the duplicate field name if used
userLang - the current language
Returns:
the converted value to export

duplicateHeader

public List<String> duplicateHeader(String name,
                                    Class<?> clazz)
Description copied from class: RawDataExportHandler
indicate if a field have other representation (like member have id and also a name)

Specified by:
duplicateHeader in class RawDataExportHandler
Parameters:
name - the name of the field (see StatEntry.STAT_FIELDS)
clazz - the class of the field (see StatEntry.STAT_FIELDS_CLASS)
Returns:
the List of other representation name

getFileExtension

public String getFileExtension()
Specified by:
getFileExtension in class RawDataExportHandler
Returns:
the file extension of generated file

getContentType

public String getContentType()
Specified by:
getContentType in class RawDataExportHandler
Returns:
the content type of the generated file


Copyright © 2001-2010 Jalios SA. All Rights Reserved.