org.exoplatform.calendar.service.impl
Class CsvImportExport

java.lang.Object
  extended by org.exoplatform.calendar.service.impl.CsvImportExport
All Implemented Interfaces:
CalendarImportExport

public class CsvImportExport
extends Object
implements CalendarImportExport

Created by The eXo Platform SAS Author : Pham Tuan tuan.pham@exoplatform.com Apr 1, 2008


Field Summary
static String CSV_PATTERN
           
static String EV_ALLDAY
           
static String EV_ATTACTMENT
           
static String EV_ATTENDEES
           
static String EV_BILLINGINFO
           
static String EV_CATEGORIES
           
static String EV_DESCRIPTION
           
static String EV_ENDDATE
           
static String EV_ENDTIME
           
static String EV_HASREMINDER
           
static String EV_INVITATION
           
static String EV_LOCATION
           
static String EV_MEETINGORGANIZER
           
static String EV_MILEAGE
           
static String EV_PRIORITY
           
static String EV_PRIVATE
           
static String EV_REMINDERDATE
           
static String EV_REMINDERTIME
           
static String EV_SENSITIVITY
           
static String EV_STARTDATE
           
static String EV_STARTTIME
           
static String EV_STATUS
           
static String EV_SUMMARY
           
 
Constructor Summary
CsvImportExport(JCRDataStorage dataStore)
          Construct a regex-based CSV parser.
 
Method Summary
 OutputStream exportCalendar(String username, List<String> calendarIds, String type)
           
 OutputStream exportCalendar(String username, List<String> calendarIds, String type, int number)
          The method exports events from eXo Calendar to icalendar file (.ics) or .csv file
 ByteArrayOutputStream exportEventCalendar(CalendarEvent event)
          The method export binary from event object
 OutputStream exportEventCalendar(String username, String calendarId, String type, String eventId)
          The method export calendar event to output stream by given event id
 List<CalendarEvent> getEventObjects(InputStream inputStream)
          The method maps the input stream to event object
 void importCalendar(String username, InputStream inputStream, String calendarId, String calendarName, Calendar from, Calendar to, boolean isNew)
          The method imports events form icalendar(.ics) or outlook calendar exported .csv file to the system
 boolean isValidate(InputStream icalInputStream)
          The method return true if the input stream is correct format
 List<String> parse(String line)
          Parse one line.
 List<CalendarEvent> process(BufferedReader in)
          Process one file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSV_PATTERN

public static final String CSV_PATTERN
See Also:
Constant Field Values

EV_SUMMARY

public static String EV_SUMMARY

EV_STARTDATE

public static String EV_STARTDATE

EV_STARTTIME

public static String EV_STARTTIME

EV_ENDDATE

public static String EV_ENDDATE

EV_ENDTIME

public static String EV_ENDTIME

EV_ALLDAY

public static String EV_ALLDAY

EV_HASREMINDER

public static String EV_HASREMINDER

EV_REMINDERDATE

public static String EV_REMINDERDATE

EV_REMINDERTIME

public static String EV_REMINDERTIME

EV_MEETINGORGANIZER

public static String EV_MEETINGORGANIZER

EV_ATTENDEES

public static String EV_ATTENDEES

EV_INVITATION

public static String EV_INVITATION

EV_ATTACTMENT

public static String EV_ATTACTMENT

EV_BILLINGINFO

public static String EV_BILLINGINFO

EV_CATEGORIES

public static String EV_CATEGORIES

EV_DESCRIPTION

public static String EV_DESCRIPTION

EV_LOCATION

public static String EV_LOCATION

EV_MILEAGE

public static String EV_MILEAGE

EV_PRIORITY

public static String EV_PRIORITY

EV_PRIVATE

public static String EV_PRIVATE

EV_SENSITIVITY

public static String EV_SENSITIVITY

EV_STATUS

public static String EV_STATUS
Constructor Detail

CsvImportExport

public CsvImportExport(JCRDataStorage dataStore)
Construct a regex-based CSV parser.

Method Detail

process

public List<CalendarEvent> process(BufferedReader in)
                            throws Exception
Process one file. Delegates to parse() a line at a time

Throws:
Exception

parse

public List<String> parse(String line)
Parse one line.

Returns:
List of Strings, minus their double quotes

exportCalendar

public OutputStream exportCalendar(String username,
                                   List<String> calendarIds,
                                   String type)
                            throws Exception
Throws:
Exception

getEventObjects

public List<CalendarEvent> getEventObjects(InputStream inputStream)
                                    throws Exception
Description copied from interface: CalendarImportExport
The method maps the input stream to event object

Specified by:
getEventObjects in interface CalendarImportExport
Parameters:
inputStream - the input stream
Returns:
List of calendar event objects contant infomations
Throws:
Exception

importCalendar

public void importCalendar(String username,
                           InputStream inputStream,
                           String calendarId,
                           String calendarName,
                           Calendar from,
                           Calendar to,
                           boolean isNew)
                    throws Exception
Description copied from interface: CalendarImportExport
The method imports events form icalendar(.ics) or outlook calendar exported .csv file to the system

Specified by:
importCalendar in interface CalendarImportExport
Parameters:
username - current user name or id
inputStream - data input stream
calendarId - given existed calendar id
calendarName - name of the new calendar, if create new
from - the first date of current time-range to import event
to - to the last date of current time-range to import event
isNew - import to new calendar or existed calendar
Throws:
Exception

isValidate

public boolean isValidate(InputStream icalInputStream)
                   throws Exception
Description copied from interface: CalendarImportExport
The method return true if the input stream is correct format

Specified by:
isValidate in interface CalendarImportExport
Parameters:
icalInputStream - the input stream
Throws:
Exception

exportCalendar

public OutputStream exportCalendar(String username,
                                   List<String> calendarIds,
                                   String type,
                                   int number)
                            throws Exception
Description copied from interface: CalendarImportExport
The method exports events from eXo Calendar to icalendar file (.ics) or .csv file

Specified by:
exportCalendar in interface CalendarImportExport
Parameters:
username - current user name or id
calendarIds - the group calendar ids, if you want to export events from public calendars
type - The type of calendar will be exported
number - the limitation number of event
Returns:
data output stream
Throws:
Exception

exportEventCalendar

public OutputStream exportEventCalendar(String username,
                                        String calendarId,
                                        String type,
                                        String eventId)
                                 throws Exception
Description copied from interface: CalendarImportExport
The method export calendar event to output stream by given event id

Specified by:
exportEventCalendar in interface CalendarImportExport
Parameters:
username - current user name or id
calendarId - given calendar id, the calendar event belong to
type - The type of calendar will be exported
eventId - given event id
Returns:
data output stream
Throws:
Exception

exportEventCalendar

public ByteArrayOutputStream exportEventCalendar(CalendarEvent event)
                                          throws Exception
Description copied from interface: CalendarImportExport
The method export binary from event object

Specified by:
exportEventCalendar in interface CalendarImportExport
Parameters:
event - : event object
Returns:
binary ics file
Throws:
Exception


Copyright © 2013 eXo Platform SAS. All Rights Reserved.