Class EventDAO

java.lang.Object
org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
org.exoplatform.agenda.dao.EventDAO
All Implemented Interfaces:
org.exoplatform.commons.api.persistence.GenericDAO<EventEntity,Long>

public class EventDAO extends org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
  • Constructor Details

  • Method Details

    • delete

      public void delete(EventEntity entity)
      Specified by:
      delete in interface org.exoplatform.commons.api.persistence.GenericDAO<EventEntity,Long>
      Overrides:
      delete in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
    • deleteCalendarEvents

      public void deleteCalendarEvents(long calendarId)
    • moveCalendarEvents

      public List<Long> moveCalendarEvents(long fromCalendarId, long toCalendarId)
      Moves all events of a calendar to another calendar in a single bulk update, keeping every event row (and its attendees, reminders, conferences, recurrences and remote identifiers) untouched apart from its calendar membership.
      Parameters:
      fromCalendarId - technical identifier of the calendar the events are moved away from
      toCalendarId - technical identifier of the calendar receiving the events
      Returns:
      List of technical identifiers of the moved events, empty when the source calendar had no events
    • deleteEventAfterRead

      public EventEntity deleteEventAfterRead(long eventId)
      Deletes an event whose attendees, conferences or reminders may have been read through this persistence context. They are deleted in bulk, which leaves such instances managed and pointing at a removed event when the context is flushed, so the pending changes are flushed and the context cleared first. The clear detaches every entity the persistence context holds, not only this event's children: a caller must not keep a managed entity across this call and rely on dirty checking or on a lazy collection of it afterwards.
      Parameters:
      eventId - the event to delete
      Returns:
      the deleted entity, null when there was none
    • deleteEvent

      public EventEntity deleteEvent(long eventId)
    • create

      public EventEntity create(EventEntity entity)
      Specified by:
      create in interface org.exoplatform.commons.api.persistence.GenericDAO<EventEntity,Long>
      Overrides:
      create in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
    • update

      public EventEntity update(EventEntity entity)
      Specified by:
      update in interface org.exoplatform.commons.api.persistence.GenericDAO<EventEntity,Long>
      Overrides:
      update in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface org.exoplatform.commons.api.persistence.GenericDAO<EventEntity,Long>
      Overrides:
      deleteAll in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
    • updateAll

      public void updateAll(List<EventEntity> entities)
      Specified by:
      updateAll in interface org.exoplatform.commons.api.persistence.GenericDAO<EventEntity,Long>
      Overrides:
      updateAll in class org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<EventEntity,Long>
    • executeDeleteCalendarEventsQuery

      public void executeDeleteCalendarEventsQuery(long calendarId)
    • getEventIds

      public List<Long> getEventIds(Date startDate, Date endDate, List<Long> ownerIds, List<Long> attendeeIds, List<org.exoplatform.agenda.constant.EventAttendeeResponse> responseTypes, List<Long> excludedCalendarIds, int limit)
      Retrieves the identifiers of the events matching a period and the given owner, attendee and response criteria.
      Parameters:
      startDate - beginning of the period, mandatory
      endDate - end of the period, null for an open period
      ownerIds - identity identifiers of the calendar owners to keep, empty or null to keep every owner
      attendeeIds - identity identifiers to filter on attendees, empty or null to ignore attendees
      responseTypes - attendee responses to keep, only used together with attendeeIds
      excludedCalendarIds - technical identifiers of the calendars whose events must be left out, whatever the owner criteria kept; empty or null to exclude nothing
      limit - maximum number of identifiers to return, 0 for no limit
      Returns:
      List of matching event technical identifiers
    • getEventIds

      public List<Long> getEventIds(Date startDate, Date endDate, List<Long> ownerIds, List<Long> attendeeIds, List<org.exoplatform.agenda.constant.EventAttendeeResponse> responseTypes, List<Long> excludedCalendarIds, List<Long> calendarIds, int limit)
      Retrieves the identifiers of the events matching a period and the given owner, attendee and response criteria, plus the events of some calendars whatever those criteria say (EXO-90357).

      One statement. The owner and attendee criteria form one conjunction, the listed calendars are or-ed with it: an event is kept when it matches the criteria, or when its calendar is listed. The attendee join becomes an outer one when calendars are listed, since an event of a shared calendar has no attendee row for the reader; DISTINCT keeps an event with several attendee rows once. The exclusion still applies to everything.

      Parameters:
      startDate - beginning of the period, mandatory
      endDate - end of the period, null for an open period
      ownerIds - identity identifiers of the calendar owners to keep, empty or null to keep every owner
      attendeeIds - identity identifiers to filter on attendees, empty or null to ignore attendees
      responseTypes - attendee responses to keep, only used together with attendeeIds
      excludedCalendarIds - technical identifiers of the calendars whose events must be left out, whatever else keeps them
      calendarIds - technical identifiers of the calendars whose events are kept whatever the owner and attendee criteria say; empty or null for none
      limit - maximum number of identifiers to return, 0 for no limit
      Returns:
      List of matching event technical identifiers
    • getUserEventCalenderIds

      public List<Long> getUserEventCalenderIds(Long userIdentityId)
    • getPendingEventIds

      public List<Long> getPendingEventIds(Long userIdentityId, List<Long> attendeeIds, List<Long> calenderIds, Date fromDate, int offset, int limit)
    • countPendingEvents

      public Long countPendingEvents(Long userIdentityId, List<Long> attendeeIds, List<Long> calenderIds, Date fromDate)
    • getPendingEventIdsByOwnerIds

      public List<Long> getPendingEventIdsByOwnerIds(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, Date fromDate, int offset, int limit)
    • countPendingEventsByOwnerIds

      public long countPendingEventsByOwnerIds(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, Date fromDate)
    • getEventDatePollIds

      public List<Long> getEventDatePollIds(Long userIdentityId, List<Long> attendeeIds, Date fromDate, int offset, int limit)
    • getEventDatePollIds

      public List<Long> getEventDatePollIds(Long userIdentityId, List<Long> attendeeIds, Date start, Date end)
    • countEventDatePolls

      public Long countEventDatePolls(List<Long> attendeeIds, Date fromDate)
    • getEventDatePollIdsByOwnerIds

      public List<Long> getEventDatePollIdsByOwnerIds(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, Date fromDate, int offset, int limit)
    • getEventDatePollIdsByOwnerIds

      public List<Long> getEventDatePollIdsByOwnerIds(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, Date start, Date end)
    • countEventDatePollsByOwnerIds

      public Long countEventDatePollsByOwnerIds(List<Long> ownerIds, List<Long> attendeeIds, Date fromDate)
    • getParentRecurrentEventIds

      public List<EventEntity> getParentRecurrentEventIds(Date startDate, Date endDate)
    • getExceptionalOccurenceIdsByPeriod

      public List<Long> getExceptionalOccurenceIdsByPeriod(long parentRecurrentEventId, Date startDate, Date endDate)
    • getExceptionalOccurenceIdsByStart

      public List<Long> getExceptionalOccurenceIdsByStart(long parentRecurrentEventId, Date startDate)
    • getExceptionalOccurenceIds

      public List<Long> getExceptionalOccurenceIds(long parentRecurrentEventId)
    • detachAll

      public void detachAll()
      Detaches every entity the thread's persistence context holds, after writing out what a running transaction has not flushed yet, so the next reads and deletes start from what the database holds. A bulk delete, as the attendee and reminder ones are, leaves the entities it removes managed: once an event was saved in the same context (agenda's reminder listener materialising a series' next days, say), deleting it fails at the flush on its attendee rows still referencing it. Nothing is lost: outside a transaction every write was already committed, and inside one it is flushed first. A caller that keeps a managed entity and uses it afterwards must reload it.
    • deleteExceptionalOccurences

      public void deleteExceptionalOccurences(long parentRecurrentEventId)