org.sakaiproject.component.legacy.calendar.readers
Class CSVReader

java.lang.Object
  extended byorg.sakaiproject.component.legacy.calendar.readers.Reader
      extended byorg.sakaiproject.component.legacy.calendar.readers.CSVReader
Direct Known Subclasses:
OutlookReader

public class CSVReader
extends Reader

This class parses a comma (or other separator other than a double-quote) delimited file.


Nested Class Summary
 
Nested classes inherited from class org.sakaiproject.component.legacy.calendar.readers.Reader
Reader.ColumnHeader, Reader.ReaderImportCell, Reader.ReaderImportRowHandler
 
Field Summary
 
Fields inherited from class org.sakaiproject.component.legacy.calendar.readers.Reader
columnHeaderMap, timeService
 
Constructor Summary
CSVReader()
          Default constructor
 
Method Summary
 List filterEvents(List events, String[] customFieldNames)
          Each derived class must implement this filter to convert the properties as set by the reader into a common set of properties that will be used to create calendar events.
 Map getDefaultColumnMap()
          Get the default column map for CSV files.
 void importStreamFromDelimitedFile(InputStream stream, Reader.ReaderImportRowHandler handler)
          Import a CSV file from a stream and callback on each row.
protected  String[] parseLineFromDelimitedFile(String line)
          Break a line's columns up into a String array.
 void setColumnDelimiter(String columnDelimiter)
          Set the delimiter
 
Methods inherited from class org.sakaiproject.component.legacy.calendar.readers.Reader
buildColumnDescriptionArray, getColumnHeaderMap, getReader, getTimeService, processLine, setColumnHeaderToAtributeMapping, setTimeService, trimLeadingTrailingQuotes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVReader

public CSVReader()
Default constructor

Method Detail

importStreamFromDelimitedFile

public void importStreamFromDelimitedFile(InputStream stream,
                                          Reader.ReaderImportRowHandler handler)
                                   throws ImportException
Import a CSV file from a stream and callback on each row.

Specified by:
importStreamFromDelimitedFile in class Reader
Parameters:
stream - Stream of CSV (or other delimited data)
handler - Callback for each row.
Throws:
ImportException

parseLineFromDelimitedFile

protected String[] parseLineFromDelimitedFile(String line)
Break a line's columns up into a String array. (One element for each column.)

Parameters:
line -

setColumnDelimiter

public void setColumnDelimiter(String columnDelimiter)
Set the delimiter


getDefaultColumnMap

public Map getDefaultColumnMap()
Get the default column map for CSV files.

Specified by:
getDefaultColumnMap in class Reader

filterEvents

public List filterEvents(List events,
                         String[] customFieldNames)
                  throws ImportException
Description copied from class: Reader
Each derived class must implement this filter to convert the properties as set by the reader into a common set of properties that will be used to create calendar events. Notably, this filter must create a ScheduleImporterService.ACTUAL_TIMERANGE property that will define the actual start time/date of the event.

Specified by:
filterEvents in class Reader
Parameters:
customFieldNames -
Throws:
ImportException