org.sakaiproject.component.legacy.calendar
Class GenericCalendarImporter

java.lang.Object
  extended byorg.sakaiproject.component.legacy.calendar.GenericCalendarImporter
All Implemented Interfaces:
CalendarImporterService

public class GenericCalendarImporter
extends Object
implements CalendarImporterService

This class provides common importing functionality after a lower-level reader has taken care of the peculiarities of a given import format.


Nested Class Summary
 class GenericCalendarImporter.PrototypeEvent
           
 
Field Summary
static String ACTUAL_TIMERANGE
           
static String DATE_DEFAULT_COLUMN_HEADER
           
static DateFormat DATE_FORMATTER
           
static String DATE_PROPERTY_NAME
           
static String DESCRIPTION_DEFAULT_COLUMN_HEADER
           
static String DESCRIPTION_PROPERTY_NAME
           
static String DURATION_DEFAULT_COLUMN_HEADER
           
static String DURATION_PROPERTY_NAME
           
static String END_TIME_DEFAULT_COLUMN_HEADER
           
static String END_TIME_PROPERTY_NAME
           
static String ENDS_DEFAULT_COLUMN_HEADER
           
static String ENDS_PROPERTY_NAME
           
static String FREQUENCY_DEFAULT_COLUMN_HEADER
           
static String FREQUENCY_PROPERTY_NAME
           
static String INTERVAL_DEFAULT_COLUMN_HEADER
           
static String INTERVAL_PROPERTY_NAME
           
static String ITEM_TYPE_DEFAULT_COLUMN_HEADER
           
static String ITEM_TYPE_PROPERTY_NAME
           
static String LOCATION_DEFAULT_COLUMN_HEADER
           
static String LOCATION_PROPERTY_NAME
           
static String REPEAT_DEFAULT_COLUMN_HEADER
           
static String REPEAT_PROPERTY_NAME
           
static String START_TIME_DEFAULT_COLUMN_HEADER
           
static String START_TIME_PROPERTY_NAME
           
static DateFormat TIME_FORMATTER
           
static DateFormat TIME_FORMATTER_WITH_SECONDS
           
static String TITLE_DEFAULT_COLUMN_HEADER
           
static String TITLE_PROPERTY_NAME
           
 
Fields inherited from interface org.sakaiproject.service.legacy.calendar.CalendarImporterService
CSV_IMPORT, MEETINGMAKER_IMPORT, OUTLOOK_IMPORT
 
Constructor Summary
GenericCalendarImporter()
          Constructor to set up a few of the formatters.
 
Method Summary
 void destroy()
          Returns to uninitialized state.
 List doImport(String importType, InputStream importStream, Map columnMapping, String[] customFieldPropertyNames)
          Perform an import given the import type.
 CalendarService getCalendarService()
          Getter for injected service
 Map getDefaultColumnMap(String importType)
          Get the default column mapping (keys are column headers, values are property names).
 Logger getLogger()
          Getter for injected service
protected  List getPrototypeEvents(List rowList, String[] customFieldPropertyNames)
          Interprets the list of maps created by doImport()
 TimeService getTimeService()
          Getter for injected service
 void init()
          Final initialization, once all dependencies are set.
 void setCalendarService(CalendarService service)
          Setter for injected service
 void setLogger(Logger logger)
          Setter for injected service
 void setTimeService(TimeService service)
          Setter for injected service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCATION_PROPERTY_NAME

public static final String LOCATION_PROPERTY_NAME
See Also:
Constant Field Values

LOCATION_DEFAULT_COLUMN_HEADER

public static final String LOCATION_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

ITEM_TYPE_PROPERTY_NAME

public static final String ITEM_TYPE_PROPERTY_NAME
See Also:
Constant Field Values

ITEM_TYPE_DEFAULT_COLUMN_HEADER

public static final String ITEM_TYPE_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

FREQUENCY_PROPERTY_NAME

public static final String FREQUENCY_PROPERTY_NAME
See Also:
Constant Field Values

FREQUENCY_DEFAULT_COLUMN_HEADER

public static final String FREQUENCY_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

END_TIME_PROPERTY_NAME

public static final String END_TIME_PROPERTY_NAME
See Also:
Constant Field Values

END_TIME_DEFAULT_COLUMN_HEADER

public static final String END_TIME_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

DURATION_PROPERTY_NAME

public static final String DURATION_PROPERTY_NAME
See Also:
Constant Field Values

DURATION_DEFAULT_COLUMN_HEADER

public static final String DURATION_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

START_TIME_PROPERTY_NAME

public static final String START_TIME_PROPERTY_NAME
See Also:
Constant Field Values

START_TIME_DEFAULT_COLUMN_HEADER

public static final String START_TIME_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

DATE_PROPERTY_NAME

public static final String DATE_PROPERTY_NAME
See Also:
Constant Field Values

DATE_DEFAULT_COLUMN_HEADER

public static final String DATE_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

DESCRIPTION_PROPERTY_NAME

public static final String DESCRIPTION_PROPERTY_NAME
See Also:
Constant Field Values

DESCRIPTION_DEFAULT_COLUMN_HEADER

public static final String DESCRIPTION_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

TITLE_PROPERTY_NAME

public static final String TITLE_PROPERTY_NAME
See Also:
Constant Field Values

TITLE_DEFAULT_COLUMN_HEADER

public static final String TITLE_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

INTERVAL_PROPERTY_NAME

public static final String INTERVAL_PROPERTY_NAME
See Also:
Constant Field Values

INTERVAL_DEFAULT_COLUMN_HEADER

public static final String INTERVAL_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

ENDS_PROPERTY_NAME

public static final String ENDS_PROPERTY_NAME
See Also:
Constant Field Values

ENDS_DEFAULT_COLUMN_HEADER

public static final String ENDS_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

REPEAT_PROPERTY_NAME

public static final String REPEAT_PROPERTY_NAME
See Also:
Constant Field Values

REPEAT_DEFAULT_COLUMN_HEADER

public static final String REPEAT_DEFAULT_COLUMN_HEADER
See Also:
Constant Field Values

ACTUAL_TIMERANGE

public static final String ACTUAL_TIMERANGE
See Also:
Constant Field Values

TIME_FORMATTER

public static final DateFormat TIME_FORMATTER

TIME_FORMATTER_WITH_SECONDS

public static final DateFormat TIME_FORMATTER_WITH_SECONDS

DATE_FORMATTER

public static final DateFormat DATE_FORMATTER
Constructor Detail

GenericCalendarImporter

public GenericCalendarImporter()
Constructor to set up a few of the formatters.

Method Detail

doImport

public List doImport(String importType,
                     InputStream importStream,
                     Map columnMapping,
                     String[] customFieldPropertyNames)
              throws ImportException
Description copied from interface: CalendarImporterService
Perform an import given the import type.

Specified by:
doImport in interface CalendarImporterService
Parameters:
importType - Type such as Outlook, MeetingMaker, etc. defined in the CalendarImporterService interface.
importStream - Stream of data to be imported
columnMapping - Map of column headers (keys) to property names (values)
customFieldPropertyNames - Array of custom properties that we want to import. null if there are no custom properties.
Returns:
A list of CalendarEvent objects. These objects are not "real", so their copies must be copied into CalendarEvents created by the Calendar service.
Throws:
ImportException

getPrototypeEvents

protected List getPrototypeEvents(List rowList,
                                  String[] customFieldPropertyNames)
                           throws ImportException
Interprets the list of maps created by doImport()

Throws:
ImportException

getDefaultColumnMap

public Map getDefaultColumnMap(String importType)
                        throws ImportException
Description copied from interface: CalendarImporterService
Get the default column mapping (keys are column headers, values are property names).

Specified by:
getDefaultColumnMap in interface CalendarImporterService
Parameters:
importType - Type such as Outlook, MeetingMaker, etc. defined in the CalendarImporterService interface.
Throws:
ImportException

getCalendarService

public CalendarService getCalendarService()
Getter for injected service


getTimeService

public TimeService getTimeService()
Getter for injected service


setCalendarService

public void setCalendarService(CalendarService service)
Setter for injected service

Parameters:
service -

setTimeService

public void setTimeService(TimeService service)
Setter for injected service

Parameters:
service -

getLogger

public Logger getLogger()
Getter for injected service


setLogger

public void setLogger(Logger logger)
Setter for injected service

Parameters:
logger -

init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Returns to uninitialized state.