Interface CalendarEventRepository
-
- All Superinterfaces:
EntityRepository<CalendarEvent>
- All Known Implementing Classes:
DefaultCalendarEventRepository
public interface CalendarEventRepository extends EntityRepository<CalendarEvent>
A persistence repository of calendar events. A calendar event is always persisted for a given calendar; a calendar event is always related to an existing calendar.- Author:
- Yohann Chastagnier
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deleteAll(Calendar calendar)
Deletes all the events that belongs to the specified calendar.static CalendarEventRepository
get()
List<CalendarEvent>
getAllBetween(CalendarEventFilter filter, Instant startDateTime, Instant endDateTime)
Gets all the events matching the specified filter and that occur between the two specified date and times.CalendarEvent
getByExternalId(Calendar calendar, String externalId)
Gets an event by its external identifier which is unique into context of a calendar.CalendarEvent
moveToCalendar(CalendarEvent event, Calendar target)
Moves the given event from specified calendar to the one theCalendarEvent
instance refers.long
size(Calendar calendar)
Gets size in events in the repository for the specified calendar.Stream<CalendarEvent>
streamAll(CalendarEventFilter filter)
Gets all the events that satisfies the specified filter
Please be careful to always close the streams in order to avoid memory leaks!!!-
Methods inherited from interface org.silverpeas.core.persistence.datasource.repository.EntityRepository
contains, delete, delete, deleteByComponentInstanceId, deleteById, deleteById, findByCriteria, flush, getAll, getById, getById, getById, save, save, save
-
-
-
-
Method Detail
-
get
static CalendarEventRepository get()
-
getByExternalId
CalendarEvent getByExternalId(Calendar calendar, String externalId)
Gets an event by its external identifier which is unique into context of a calendar.- Parameters:
calendar
- the calendar to search into.externalId
- the external identifier as string.- Returns:
- the calendar event if any, null otherwise.
-
streamAll
Stream<CalendarEvent> streamAll(CalendarEventFilter filter)
Gets all the events that satisfies the specified filter
Please be careful to always close the streams in order to avoid memory leaks!!!try(Stream<CalendarEvent> event : streamAll(myFilter)) { // Performing the treatment }
- Parameters:
filter
- a filter to apply on the calendar events to return. The filter can be empty and then no filtering will be applied on the requested calendar events.- Returns:
- the events as a stream.
-
deleteAll
void deleteAll(Calendar calendar)
Deletes all the events that belongs to the specified calendar.- Parameters:
calendar
- the calendar for which all the events must be deleted.
-
size
long size(Calendar calendar)
Gets size in events in the repository for the specified calendar.- Parameters:
calendar
- the calendar for which all the events must be counted.- Returns:
- the count of events in the given calendar.
-
getAllBetween
List<CalendarEvent> getAllBetween(CalendarEventFilter filter, Instant startDateTime, Instant endDateTime)
Gets all the events matching the specified filter and that occur between the two specified date and times.- Parameters:
filter
- a filter to apply on the calendar events to return. The filter can be empty and then no filtering will be applied on the requested calendar events.startDateTime
- the inclusive instant in UTC/Greenwich at which begins the period in which the events are get.endDateTime
- the inclusive instant in UTC/Greenwich at which ends the period in which the events are get.- Returns:
- a list of events filtering by the given filter and that occur between the two date times or an empty list if there is no events matching the specified arguments.
-
moveToCalendar
CalendarEvent moveToCalendar(CalendarEvent event, Calendar target)
Moves the given event from specified calendar to the one theCalendarEvent
instance refers.- Parameters:
event
- the event instance with previous calendar linkingtarget
- the calendar into which the event must be moved- Returns:
- the updated calendar.
-
-