Interface AgendaEventService


  • public interface AgendaEventService
    • Method Detail

      • getEvents

        List<Event> getEvents​(EventFilter eventFilter,
                              ZoneId userTimeZone,
                              long userIdentityId)
                       throws IllegalAccessException
        Retrieves the list of events available for a designated user filtered by criteria defined in a filter.
        Parameters:
        eventFilter - a filter used to define criteria to get list of objects
        userIdentityId - user Identity identifier
        userTimeZone - User time zone
        Returns:
        List of Event accessible to user
        Throws:
        IllegalAccessException - when user is not allowed to access events
      • getParentRecurrentEvents

        List<Event> getParentRecurrentEvents​(ZonedDateTime start,
                                             ZonedDateTime end,
                                             ZoneId timeZone)
        Retrieve parent recurrent events switch event filter.
        Parameters:
        start - start of period of events to retrieve
        end - end of period of events to retrieve
        timeZone - used time zone to compute dates
        Returns:
        List of Event
      • getEventById

        Event getEventById​(long eventId,
                           ZoneId timeZone,
                           long identityId)
                    throws IllegalAccessException
        Retrieves an event identified by its technical identifier.
        Parameters:
        eventId - technical identifier of event
        timeZone - used timezone to convert dates
        identityId - Identity technical identifier
        Returns:
        Corresponding Event or null if not found
        Throws:
        IllegalAccessException - when user is not allowed to access event
      • getEventById

        Event getEventById​(long eventId)
        Retrieves an event identified by its technical identifier.
        Parameters:
        eventId - technical identifier of event
        Returns:
        Corresponding Event or null if not found
      • getEventOccurrence

        Event getEventOccurrence​(long parentEventId,
                                 ZonedDateTime occurrenceId,
                                 ZoneId userTimeZone,
                                 long identityId)
                          throws IllegalAccessException
        Retrieves Event Occurrence identified by parent recurrence Event identifier and occurrence date
        Parameters:
        parentEventId - Event technical identifier
        occurrenceId - Date of occurrence
        userTimeZone - used user timezone
        identityId - user Identity identifier requesting event
        Returns:
        Event representing occurrence of parent recurrent event
        Throws:
        IllegalAccessException - when user is accessing not allowed event
      • getExceptionalOccurrenceEvents

        List<Event> getExceptionalOccurrenceEvents​(long eventId,
                                                   ZoneId timeZone,
                                                   long userIdentityId)
                                            throws IllegalAccessException
        Retrieves the list of exceptional occurrences of an event identified by its technical identifier.
        Parameters:
        eventId - technical identifier of parent recurrent event
        timeZone - used timezone to compute events
        userIdentityId -
        Returns:
        list of Exceptional Events if found, else null
        Throws:
        IllegalAccessException - when user is not allowed to access event
      • getExceptionalOccurrenceEvent

        Event getExceptionalOccurrenceEvent​(long eventId,
                                            ZonedDateTime occurrenceId)
        Retrieves an event identified by its technical identifier.
        Parameters:
        eventId - technical identifier of parent recurrent event
        occurrenceId - technical occurrence event identifier
        Returns:
        Exceptional Event if found, else null
      • createEventExceptionalOccurrence

        Event createEventExceptionalOccurrence​(long eventId,
                                               List<EventAttendee> attendees,
                                               List<EventConference> conferences,
                                               List<EventReminder> reminders,
                                               ZonedDateTime occurrenceId)
                                        throws AgendaException
        Create a new exceptional occurrence for a parent recurrent event
        Parameters:
        eventId - technical identifier of parent recurrent event
        attendees - List of attendees
        conferences - List of conferences
        reminders - List of reminders
        occurrenceId - event occurent identifier
        Returns:
        newly created Event
        Throws:
        AgendaException - when the event attributes aren't valid
      • saveEventExceptionalOccurrence

        Event saveEventExceptionalOccurrence​(long eventId,
                                             ZonedDateTime occurrenceId)
                                      throws AgendaException
        Creates an exceptional occurrence for a recurrent event and occurrence ID
        Parameters:
        eventId - parent recurrent event identifier
        occurrenceId - Occurrence identifier
        Returns:
        created Event
        Throws:
        AgendaException - when an error occurs hile creating event
      • updateEventFields

        void updateEventFields​(long eventId,
                               Map<String,​List<String>> fields,
                               boolean updateAllOccurrences,
                               boolean sendInvitation,
                               long userIdentityId)
                        throws IllegalAccessException,
                               org.exoplatform.commons.exception.ObjectNotFoundException,
                               AgendaException
        Updates a single field for a given Event identified by its technical identifier. When the event is of type 'recurrent', if parameter updateAllOccurrences is set to true, it will update the event field for all exceptional occurrences as well.
        Parameters:
        eventId - Event technical identifier to update
        fields - Event fields with field name as map key and field value as map value
        updateAllOccurrences - whether apply modification on all exceptional occurrences as well or not
        sendInvitation - whether re-send invitation to attendees or not
        userIdentityId - user Identity identifier
        Throws:
        IllegalAccessException - when user is not allowed to update event
        org.exoplatform.commons.exception.ObjectNotFoundException - when the event identified by its technical identifier is not found
        AgendaException - when the event attribute isn't valid
      • deleteEventById

        Event deleteEventById​(long eventId,
                              long userIdentityId)
                       throws IllegalAccessException,
                              org.exoplatform.commons.exception.ObjectNotFoundException
        Deletes an existing event
        Parameters:
        eventId - Event technical identifier to delete
        userIdentityId - user Identity identifier
        Returns:
        deleted Event
        Throws:
        IllegalAccessException - when user is not authorized to delete the event
        org.exoplatform.commons.exception.ObjectNotFoundException - when the event identified by its technical identifier is not found
      • canAccessEvent

        boolean canAccessEvent​(Event event,
                               long identityId)
        Check whether user can access event or not.
        Parameters:
        event - Event to check its permission
        identityId - Identity technical identifier
        Returns:
        true if the user is a member of Calendar owner Identity or is an EventAttendee, else return false.
      • canUpdateEvent

        boolean canUpdateEvent​(Event event,
                               long userIdentityId)
        Check whether user can update or delete an event or not.
        Parameters:
        event - Event to check its permission
        userIdentityId - user Identity identifier
        Returns:
        true if the user is a manager of Calendar owner Identity or is an EventAttendee, else return false.
      • canCreateEvent

        boolean canCreateEvent​(Calendar calendar,
                               long userIdentityId)
        Check whether user can create an event in selected Calendar or not.
        Parameters:
        calendar - of type Calendar
        userIdentityId - user Identity identifier
        Returns:
        true if the user is a member of Calendar owner Identity, else return false.
      • search

        List<EventSearchResult> search​(long userIdentityId,
                                       ZoneId userTimeZone,
                                       String query,
                                       int offset,
                                       int limit)
        Search the list of events available with query for the currentUser
        Parameters:
        userIdentityId - user Identity identifier
        userTimeZone - used user timezone
        query - Term to search
        offset - offset
        limit - Limit of events to retrieve
        Returns:
        List of EventSearchResult
      • getEventOccurrencesInPeriod

        List<Event> getEventOccurrencesInPeriod​(Event recurrentEvent,
                                                ZonedDateTime start,
                                                ZonedDateTime end,
                                                ZoneId timezone,
                                                int limit)
        Retrieves occurrences, without exceptional, of a recurrent event in a given period of time.
        Parameters:
        recurrentEvent - Event of type recurrence
        start - Period start date
        end - Period end date
        timezone - used timezone to compute events
        limit - maximum number of occurrences to retrieve
        Returns:
        List of Event of type Occurrence (not Exceptional occurrences)
      • selectEventDateOption

        void selectEventDateOption​(long eventId,
                                   long dateOptionId,
                                   long userIdentityId)
                            throws org.exoplatform.commons.exception.ObjectNotFoundException,
                                   IllegalAccessException
        Choose a selected EventDateOption for a given Event
        Parameters:
        eventId - technical identifier of Event
        dateOptionId - Technical identifier of EventDateOption
        userIdentityId - user Identity identifier
        Throws:
        org.exoplatform.commons.exception.ObjectNotFoundException - when Event is not found using identifier or EventDateOption is not found using technical identifier
        IllegalAccessException - when user is not an allowed participant of the event who can modifies it
      • getEventDatePolls

        List<Event> getEventDatePolls​(EventFilter eventFilter,
                                      ZoneId userTimeZone,
                                      long attendeeId)
                               throws IllegalAccessException
        Retrieves the list of pending date polls where the current user is invited
        Parameters:
        eventFilter - a filter used to define criteria to get list of objects
        userTimeZone - used to compute events dates switch given time zone
        attendeeId - user Identity identifier
        Returns:
        List date poll Event for user
        Throws:
        IllegalAccessException - when user is not an allowed to access one of ownerIds events
      • countEventDatePolls

        long countEventDatePolls​(List<Long> ownerIds,
                                 long attendeeId)
                          throws IllegalAccessException
        Count pending date polls where the current user is invited
        Parameters:
        ownerIds - List of Identity technical identifier
        attendeeId - user Identity identifier
        Returns:
        List date poll Event for user
        Throws:
        IllegalAccessException - when user is not an allowed to access one of ownerIds events
      • getPendingEvents

        List<Event> getPendingEvents​(List<Long> ownerIds,
                                     long userIdentityId,
                                     ZoneId userTimeZone,
                                     int offset,
                                     int limit)
                              throws IllegalAccessException
        Retrieve pending events that the selected user didn't answered yet
        Parameters:
        ownerIds - List of Identity technical identifier
        userIdentityId - user Identity identifier
        userTimeZone - User time zone
        offset - offset of the events to retrieve
        limit - Limit of events to retrieve
        Returns:
        List of Event
        Throws:
        IllegalAccessException - when user is not an allowed to access one of ownerIds events
      • countPendingEvents

        long countPendingEvents​(List<Long> ownerIds,
                                long userIdentityId)
                         throws IllegalAccessException
        Count pending events that the selected user didn't answered yet
        Parameters:
        ownerIds - List of Identity technical identifier
        userIdentityId - user Identity identifier
        Returns:
        pending events count
        Throws:
        IllegalAccessException - when user is not an allowed to access one of ownerIds events