Class ICalendarEventImportProcessor


  • @Service
    public class ICalendarEventImportProcessor
    extends Object
    A processor of importation of events from an iCalendar source into the Silverpeas Calendar Engine.

    The processor consumes an input stream or a reader of an iCalendar source to produce the CalendarEvent and the CalendarEventOccurrence instances that will be then saved into the Silverpeas calendar passed as argument. Any events or occurrences yet existing in the calendar will be updated. The occurrences in the calendar that aren't anymore referenced in the iCalendar source will be deleted. The import doesn't delete any events but only adds or updates the events from the iCalendar source.

    In the case of an import into a synchronized calendar, the import processor will consider the operation as being part of a synchronization with an external calendar. In that case, the events coming from the iCalendar source will be timestamped with the synchronization date of the synchronized calendar.

    Author:
    mmoquillon
    • Constructor Detail

      • ICalendarEventImportProcessor

        public ICalendarEventImportProcessor()
    • Method Detail

      • importInto

        public ICalendarImportResult importInto​(Calendar calendar,
                                                InputStream inputStream)
                                         throws ImportException
        Imports into the specified calendar in Silverpeas the events encoded in the iCalendar format coming from the specified input stream.

        All new events will be added in the given calendar. All already existing events in the calendar will be updated with their more recent counterpart in the iCalendar source. This policy is applied also on the occurrences of the events. unlike with the occurrences, any events in the calendar not present in the iCalendar source won't be touched. For a synchronized calendar, the imported events will be timestamped with calendar's synchronization date.

        The calendar must exist in Silverpeas otherwise an IllegalArgumentException is thrown.

        Parameters:
        calendar - a calendar in Silverpeas.
        inputStream - the input stream in which are encoded the events to import.
        Returns:
        the result of the import process.
        Throws:
        ImportException - exception thrown if the import fails.
      • importInto

        public ICalendarImportResult importInto​(Calendar calendar,
                                                Reader reader)
                                         throws ImportException
        Imports into the specified calendar in Silverpeas the events encoded in the iCalendar format coming from the specified io reader.

        All new events will be added in the given calendar. All already existing events in the calendar will be updated with their more recent counterpart in the iCalendar source. This policy is applied also on the occurrences of the events. unlike with the occurrences, any events in the calendar not present in the iCalendar source won't be touched. For a synchronized calendar, the imported events will be timestamped with calendar's synchronization date.

        The calendar must exist in Silverpeas otherwise an IllegalArgumentException is thrown.

        Parameters:
        calendar - a calendar in Silverpeas.
        reader - the reader in which are encoded the events to import.
        Returns:
        the result of the import process.
        Throws:
        ImportException - exception thrown if the import fails.
      • importInto

        protected ICalendarImportResult importInto​(Calendar calendar,
                                                   ImportDescriptor descriptor)
                                            throws ImportException
        Imports into the specified calendar in Silverpeas the events encoded in the iCalendar format with the specified descriptor of import.

        It is the effective import process dedicated to be used by the Silverpeas Calendar Engine to fetch and store calendar events coming from an external calendar. This process can be simply an importation of an iCalendar source content or a synchronization with an external calendar. The ony difference between an simple importation and a synchronization is that in the synchronization the calendar's synchronization date will be set for each event fetched from the iCalendar source; the behavior of the method doesn't change.

        The calendar must exist in Silverpeas otherwise an IllegalArgumentException is thrown.

        Parameters:
        calendar - a calendar in Silverpeas.
        descriptor - a descriptor of import with the iCalendar source from which the event will be parsed.
        Returns:
        the result of the import process.
        Throws:
        ImportException - exception thrown if the import fails.