Package org.exoplatform.agenda.storage
Class AgendaEventStorage
java.lang.Object
org.exoplatform.agenda.storage.AgendaEventStorage
- Direct Known Subclasses:
CachedAgendaEventStorage
-
Constructor Summary
ConstructorsConstructorDescriptionAgendaEventStorage(CalendarDAO calendarDAO, EventDAO eventDAO, EventRecurrenceDAO eventRecurrenceDAO) -
Method Summary
Modifier and TypeMethodDescriptionlongcountEventDatePolls(List<Long> ownerIds, List<Long> attendeeIds) longcountPendingEvents(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, List<Long> calenderIds) org.exoplatform.agenda.model.EventcreateEvent(org.exoplatform.agenda.model.Event event) voiddeleteCalendarEvents(long calendarId) voiddeleteEventAfterRead(long eventId) Deletes an event whose attendees, conferences or reminders were read in the same request, whichdeleteEventById(long)cannot: the persistence context is cleared before the bulk deletion of its children.voiddeleteEventById(long eventId) deleteExceptionalOccurences(long parentRecurrentEventId) deleteExceptionalOccurencesOfSavedSeries(long parentRecurrentEventId) Deletes the exceptional occurrences of a series that was just saved in this persistence context, starting from what the database holds (EventDAO.detachAll()): the rows agenda's reminder listener materialised on the save are still managed, and deleting them in place fails at the flush.voidevictEvents(Collection<Long> eventIds) Evicts events from the cache this storage reads through, once the transaction that read or wrote them has ended.org.exoplatform.agenda.model.EventfindExceptionalOccurrence(org.exoplatform.agenda.model.Event series, ZonedDateTime occurrenceId) Finds the row a series holds for one of its dates: the row whose occurrence id designates the same date of the series (Utils.isSameSeriesDate(org.exoplatform.agenda.model.Event, java.time.ZonedDateTime, java.time.ZonedDateTime)), the first created when the date has several.org.exoplatform.agenda.model.EventgetEventById(long eventId) getEventDatePollIds(long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, ZonedDateTime start, ZonedDateTime end) getEventDatePollIds(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, int offset, int limit) getEventIds(org.exoplatform.agenda.model.EventFilter eventFilter) Retrieves the identifiers of the events matching a filter.getExceptionalOccurenceIds(long parentRecurrentEventId) getExceptionalOccurenceIdsByPeriod(long parentRecurrentEventId, ZonedDateTime start, ZonedDateTime end) List<org.exoplatform.agenda.model.Event> getExceptionalOccurrences(long parentRecurrentEventId) Reads the exceptional occurrences of a recurrent event in one statement, ordered by start date.List<org.exoplatform.agenda.model.Event> getParentRecurrentEventIds(ZonedDateTime start, ZonedDateTime end) getPendingEventIds(Long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, List<Long> calenderIds, int offset, int limit) getUserEventCalenderIds(Long userIdentityId) booleanisRecurrentEvent(long eventId) booleanlockEvents(long... eventIds) Locks event rows until the current transaction ends, as its first reads: every row is locked before any of them is read.moveCalendarEvents(long fromCalendarId, long toCalendarId) Moves all events of a calendar to another calendar, keeping every event and its associated data (attendees, reminders, conferences, recurrences, remote identifiers) untouched apart from the calendar membership.voidsaveCapacityReachedDate(long eventId, ZonedDateTime capacityReachedDate) Writes the mark of an event row's pool having reached its capacity, and nothing else of the row: once the row exists, the only write of that mark, which a save of the whole row leaves as it is.org.exoplatform.agenda.model.EventupdateEvent(org.exoplatform.agenda.model.Event event)
-
Constructor Details
-
AgendaEventStorage
public AgendaEventStorage(CalendarDAO calendarDAO, EventDAO eventDAO, EventRecurrenceDAO eventRecurrenceDAO)
-
-
Method Details
-
getEventIds
Retrieves the identifiers of the events matching a filter.- Parameters:
eventFilter- criteria of the events to retrieve- Returns:
Listof matching event technical identifiers
-
getPendingEventIds
-
countPendingEvents
-
getUserEventCalenderIds
-
getEventDatePollIds
-
getEventDatePollIds
public List<Long> getEventDatePollIds(long userIdentityId, List<Long> ownerIds, List<Long> attendeeIds, ZonedDateTime start, ZonedDateTime end) -
countEventDatePolls
-
getParentRecurrentEventIds
public List<org.exoplatform.agenda.model.Event> getParentRecurrentEventIds(ZonedDateTime start, ZonedDateTime end) -
getEventById
public org.exoplatform.agenda.model.Event getEventById(long eventId) -
deleteEventById
public void deleteEventById(long eventId) -
deleteEventAfterRead
public void deleteEventAfterRead(long eventId) Deletes an event whose attendees, conferences or reminders were read in the same request, whichdeleteEventById(long)cannot: the persistence context is cleared before the bulk deletion of its children.- Parameters:
eventId- the event to delete
-
deleteCalendarEvents
public void deleteCalendarEvents(long calendarId) -
moveCalendarEvents
Moves all events of a calendar to another calendar, keeping every event and its associated data (attendees, reminders, conferences, recurrences, remote identifiers) untouched apart from the calendar membership.- Parameters:
fromCalendarId- technical identifier of the calendar the events are moved away fromtoCalendarId- technical identifier of the calendar receiving the events- Returns:
Listof technical identifiers of the moved events, empty when the source calendar had no events
-
getExceptionalOccurenceIds
- Parameters:
parentRecurrentEventId- a parent recurrentEventtechnical identifier- Returns:
Listof Event identifiers corresponding to exceptional occurences events Identifiers of a parent recurrent event for a selected period of time
-
getExceptionalOccurenceIdsByPeriod
public List<Long> getExceptionalOccurenceIdsByPeriod(long parentRecurrentEventId, ZonedDateTime start, ZonedDateTime end) - Parameters:
parentRecurrentEventId- a parent recurrentEventtechnical identifierstart- start DateTime of period to search onend- end DateTime of period to search on- Returns:
Listof Event identifiers corresponding to exceptional occurences events Identifiers of a parent recurrent event for a selected period of time
-
getExceptionalOccurrences
public List<org.exoplatform.agenda.model.Event> getExceptionalOccurrences(long parentRecurrentEventId) Reads the exceptional occurrences of a recurrent event in one statement, ordered by start date.- Parameters:
parentRecurrentEventId- a parent recurrentEventtechnical identifier- Returns:
Listof its exceptional occurrence events
-
lockEvents
public boolean lockEvents(long... eventIds) Locks event rows until the current transaction ends, as its first reads: every row is locked before any of them is read. The persistence context is flushed then cleared first, so that no entity loaded before the lock is served after it with the state it had then. The rows are locked in ascending identifier order, so that two transactions locking the same rows cannot deadlock.- Parameters:
eventIds- the technical identifiers of the events to lock- Returns:
- whether every row exists, and so is locked; false as soon as one does not
-
evictEvents
Evicts events from the cache this storage reads through, once the transaction that read or wrote them has ended. This storage has no cache.- Parameters:
eventIds- the technical identifiers of the events to evict
-
createEvent
public org.exoplatform.agenda.model.Event createEvent(org.exoplatform.agenda.model.Event event) -
deleteExceptionalOccurencesOfSavedSeries
Deletes the exceptional occurrences of a series that was just saved in this persistence context, starting from what the database holds (EventDAO.detachAll()): the rows agenda's reminder listener materialised on the save are still managed, and deleting them in place fails at the flush. The clear detaches every entity of the thread's persistence context, not only this series': a caller must not keep a managed entity across this call and rely on it afterwards, asdeleteEventAfterRead(long)already requires.- Parameters:
parentRecurrentEventId- the series- Returns:
- the ids of the occurrences deleted
-
deleteExceptionalOccurences
-
findExceptionalOccurrence
public org.exoplatform.agenda.model.Event findExceptionalOccurrence(org.exoplatform.agenda.model.Event series, ZonedDateTime occurrenceId) Finds the row a series holds for one of its dates: the row whose occurrence id designates the same date of the series (Utils.isSameSeriesDate(org.exoplatform.agenda.model.Event, java.time.ZonedDateTime, java.time.ZonedDateTime)), the first created when the date has several.The occurrence list hides the computed dates a row stands for with a rule of its own, the same UTC day or less than twelve hours apart, which knows neither the series' zone nor its several dates a day.
- Parameters:
series- the seriesoccurrenceId- the date's occurrence id- Returns:
- the date's row, or null when it has none
-
updateEvent
public org.exoplatform.agenda.model.Event updateEvent(org.exoplatform.agenda.model.Event event) -
saveCapacityReachedDate
Writes the mark of an event row's pool having reached its capacity, and nothing else of the row: once the row exists, the only write of that mark, which a save of the whole row leaves as it is. It requires an active transaction, the one of the decide step holding the event lock.- Parameters:
eventId- event identifiercapacityReachedDate- the instant the pool is marked as having reached its capacity, or null to clear the mark
-
isRecurrentEvent
public boolean isRecurrentEvent(long eventId)
-