Class CalendarWebManager

    • Field Detail

      • NAME_SUFFIX

        public static final String NAME_SUFFIX
        The predefined suffix that must compound the name of each implementation of this interface. An implementation of this interface by a Silverpeas application named Kmelia must be named kmelia[NAME_SUFFIX] where NAME_SUFFIX is the predefined suffix as defined below.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CalendarWebManager

        protected CalendarWebManager()
    • Method Detail

      • createEvent

        public CalendarEvent createEvent​(Calendar calendar,
                                         CalendarEvent event,
                                         String volatileEventId)
        Creates an event from the given calendar and event data.
        This method handles also a common behavior the UI must have between each way an event is saved (from a controller, a WEB service...)
        Parameters:
        calendar - the calendar on which the event is added.
        event - the event to create.
        volatileEventId - the volatile identifier used to attach the images on WYSIWYG editor.
        Returns:
        the calendar event.
      • getLocalizationBundle

        public LocalizationBundle getLocalizationBundle​(String locale)
        Gets the common calendar bundle according to the given locale.
        Parameters:
        locale - the locale into which the requested bundle must be set.
        Returns:
        a localized bundle.
      • getCalendarsHandledBy

        public List<Calendar> getCalendarsHandledBy​(String componentInstanceId)
        Gets all calendars handled by a component instance.

        This centralization is useful for components which handles other agendas than those linked to the instance.

        Parameters:
        componentInstanceId - the identifier of the component instance.
        Returns:
        the list of calendars.
      • getCalendarsHandledBy

        public List<Calendar> getCalendarsHandledBy​(Collection<String> componentInstanceIds)
        Gets all calendars handled by component instances.

        This centralization is useful for components which handles other agendas than those linked to the instance.

        This is a signature design for performances.

        Parameters:
        componentInstanceIds - identifier of the component instances.
        Returns:
        the list of calendars.
      • saveCalendar

        protected Calendar saveCalendar​(Calendar calendar)
        Saves the given calendar.
        This method handles also a common behavior the UI must have between each way a calendar is saved (from a controller, a WEB service...)
        Parameters:
        calendar - the calendar to save.
        Returns:
        the calendar.
      • deleteCalendar

        protected void deleteCalendar​(Calendar calendar)
        Deletes the given calendar.
        This method handles also a common behavior the UI must have between each way a calendar is deleted (from a controller, a WEB service...)
        Parameters:
        calendar - the calendar to delete.
      • exportCalendarAsICalendarFormat

        protected void exportCalendarAsICalendarFormat​(Calendar calendar,
                                                       ExportDescriptor descriptor)
                                                throws ExportException
        Exports the given calendar into ICalendar format.
        Parameters:
        calendar - the calendar to export.
        descriptor - the export descriptor.
        Throws:
        ExportException - on error in the export.
      • synchronizeCalendar

        protected void synchronizeCalendar​(Calendar calendar)
                                    throws ImportException
        Synchronizes the given calendar.

        Throws a forbidden WEB application exception if the calendar is not a synchronized one

        Parameters:
        calendar - the calendar to synchronize.
        Throws:
        ImportException
      • importEventsAsICalendarFormat

        protected void importEventsAsICalendarFormat​(Calendar calendar,
                                                     InputStream inputStream)
                                              throws ImportException
        Imports the calendar events into the specified calendar from the specified input stream.
        Parameters:
        inputStream - an input stream from which the serialized calendar events can be imported.
        Throws:
        ImportException
      • saveOccurrence

        protected List<CalendarEvent> saveOccurrence​(CalendarEventOccurrence occurrence,
                                                     OccurrenceEventActionMethodType updateMethodType,
                                                     ZoneId zoneId)
        Saves an event occurrence.
        This method handles also a common behavior the UI must have between each way an event is saved (from a controller, a WEB service...)
        Parameters:
        occurrence - the occurrence to save.
        updateMethodType - indicates the method of the occurrence update.
        zoneId - the zoneId into which dates are displayed (optional). @return the calendar event.
      • deleteOccurrence

        protected CalendarEvent deleteOccurrence​(CalendarEventOccurrence occurrence,
                                                 OccurrenceEventActionMethodType deleteMethodType,
                                                 ZoneId zoneId)
        Deletes occurrences of an event from the given occurrence.
        This method handles also a common behavior the UI must have between each way an event is deleted (from a controller, a WEB service...)
        Parameters:
        occurrence - the occurrence to delete.
        deleteMethodType - indicates the method of the occurrence deletion.
        zoneId - the zoneId into which dates are displayed (optional).
      • updateOccurrenceAttendeeParticipation

        protected CalendarEvent updateOccurrenceAttendeeParticipation​(CalendarEventOccurrence occurrence,
                                                                      String attendeeId,
                                                                      Attendee.ParticipationStatus participationStatus,
                                                                      OccurrenceEventActionMethodType answerMethodType,
                                                                      ZoneId zoneId)
        Updates the participation of an attendee of an event or on an occurrence of an event from the given data.
        This method handles also a common behavior the UI must have between each way an event is deleted (from a controller, a WEB service...)
        Parameters:
        occurrence - the occurrence.
        attendeeId - the identifier of the attendee which answered.
        participationStatus - the participation answer of the attendee.
        answerMethodType - indicates the method of the occurrence deletion.
        zoneId - the zoneId into which dates are displayed (optional).
      • getFirstCalendarEventOccurrenceFromEventId

        public CalendarEventOccurrence getFirstCalendarEventOccurrenceFromEventId​(String eventId)
        Gets the first occurrence of an event from the identifier of an event.
        Parameters:
        eventId - an event identifier.
        Returns:
        the first CalendarEventOccurrence instance of an event.
      • getEventOccurrencesOf

        public List<CalendarEventOccurrence> getEventOccurrencesOf​(LocalDate startDate,
                                                                   LocalDate endDate,
                                                                   List<Calendar> calendars)
        Gets the event occurrences associated to a calendar and contained a time window specified by the start and end datetime.
        The occurrences are sorted from the lowest to the highest date.
        Parameters:
        startDate - the start date of time window.
        endDate - the end date of time window.
        calendars - the calendars the event occurrences belong to.
        Returns:
        a list of entities of calendar event occurrences.
      • getEventOccurrencesOf

        public List<CalendarEventOccurrence> getEventOccurrencesOf​(LocalDate startDate,
                                                                   LocalDate endDate,
                                                                   List<Calendar> calendars,
                                                                   User currentRequester)
        Gets the event occurrences associated to a calendar and contained a time window specified by the start and end datetime.
        The occurrences are sorted from the lowest to the highest date.
        Parameters:
        startDate - the start date of time window.
        endDate - the end date of time window.
        calendars - the calendars the event occurrences belong to.
        Returns:
        a list of entities of calendar event occurrences.
      • getAllEventOccurrencesByUserIds

        protected Map<String,​List<CalendarEventOccurrence>> getAllEventOccurrencesByUserIds​(org.apache.commons.lang3.tuple.Pair<List<String>,​User> currentUserAndComponentInstanceId,
                                                                                                  LocalDate startDate,
                                                                                                  LocalDate endDate,
                                                                                                  Collection<User> users)
        Gets all event occurrences associated to users and contained a time window specified by the start and end date times.
        Attendees which have answered negatively about their presence are not taken into account. The occurrences are sorted from the lowest to the highest date and mapped by user identifiers.
        Parameters:
        currentUserAndComponentInstanceId - the current user and the current component instance ids from which the service is requested.
        startDate - the start date of time window.
        endDate - the end date of time window.
        users - the users to filter on.
        Returns:
        a list of entities of calendar event occurrences mapped by user identifiers.
      • getNextEventOccurrences

        public Stream<CalendarEventOccurrence> getNextEventOccurrences​(List<String> componentIds,
                                                                       Set<String> calendarIdsToExclude,
                                                                       Set<User> usersToInclude,
                                                                       Set<String> calendarIdsToInclude,
                                                                       ZoneId zoneId,
                                                                       Integer limit)
        Gets the next event occurrences from now.
        Parameters:
        componentIds - identifiers of aimed component instance.
        calendarIdsToExclude - identifier of calendars which linked occurrences must be excluded from the result.
        usersToInclude - identifiers of users which linked occurrences must be included into the result
        calendarIdsToInclude - identifier of calendars which linked occurrences must be included into the result.
        zoneId - the identifier of the zone.
        limit - the maximum occurrences the result must have (must be lower than 500)
        Returns:
        a list of CalendarEventOccurrence.
      • getNextEventTimeWindows

        protected Integer[] getNextEventTimeWindows()
        Gets next event time windows from settings.
        Returns:
        list of integer which represents months.