Class DefaultCalendarEventRepository
- java.lang.Object
-
- org.silverpeas.core.persistence.datasource.repository.jpa.AbstractJpaEntityRepository<E>
-
- org.silverpeas.core.persistence.datasource.repository.jpa.BasicJpaEntityRepository<CalendarEvent>
-
- org.silverpeas.core.calendar.repository.DefaultCalendarEventRepository
-
- All Implemented Interfaces:
CalendarEventRepository
,EntityRepository<CalendarEvent>
,WithSaveAndFlush<CalendarEvent>
@Repository public class DefaultCalendarEventRepository extends BasicJpaEntityRepository<CalendarEvent> implements CalendarEventRepository
- Author:
- Yohann Chastagnier
-
-
Constructor Summary
Constructors Constructor Description DefaultCalendarEventRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAll(Calendar calendar)
Deletes all the events that belongs to the specified calendar.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 class org.silverpeas.core.persistence.datasource.repository.jpa.BasicJpaEntityRepository
deleteByComponentInstanceId, saveAndFlush
-
Methods inherited from class org.silverpeas.core.persistence.datasource.repository.jpa.AbstractJpaEntityRepository
contains, countByCriteria, countFromJpqlString, delete, deleteById, deleteFromJpqlQuery, deleteFromNamedQuery, findByCriteria, findByNamedQuery, findFirstByNamedQuery, flush, getAll, getById, getById, getEntityClass, getEntityManager, getFromJpqlString, getFromJpqlString, getFromNamedQuery, getFromNamedQuery, getIdentifierConverter, getMaximumItemsInClause, listFromJpqlString, listFromJpqlString, listFromJpqlString, listFromJpqlString, listFromNamedQuery, listFromNamedQuery, newNamedParameters, noParameter, save, setMaximumItemsInClause, split, streamByNamedQuery, streamByNamedQuery, streamFromJpqlString, streamFromJpqlString, updateFromJpqlQuery, updateFromNamedQuery
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
getByExternalId
public CalendarEvent getByExternalId(Calendar calendar, String externalId)
Description copied from interface:CalendarEventRepository
Gets an event by its external identifier which is unique into context of a calendar.- Specified by:
getByExternalId
in interfaceCalendarEventRepository
- Parameters:
calendar
- the calendar to search into.externalId
- the external identifier as string.- Returns:
- the calendar event if any, null otherwise.
-
streamAll
public Stream<CalendarEvent> streamAll(CalendarEventFilter filter)
Description copied from interface:CalendarEventRepository
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 }
- Specified by:
streamAll
in interfaceCalendarEventRepository
- 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.
-
size
public long size(Calendar calendar)
Description copied from interface:CalendarEventRepository
Gets size in events in the repository for the specified calendar.- Specified by:
size
in interfaceCalendarEventRepository
- Parameters:
calendar
- the calendar for which all the events must be counted.- Returns:
- the count of events in the given calendar.
-
getAllBetween
public List<CalendarEvent> getAllBetween(CalendarEventFilter filter, Instant startDateTime, Instant endDateTime)
Description copied from interface:CalendarEventRepository
Gets all the events matching the specified filter and that occur between the two specified date and times.- Specified by:
getAllBetween
in interfaceCalendarEventRepository
- 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
public CalendarEvent moveToCalendar(CalendarEvent event, Calendar target)
Description copied from interface:CalendarEventRepository
Moves the given event from specified calendar to the one theCalendarEvent
instance refers.- Specified by:
moveToCalendar
in interfaceCalendarEventRepository
- Parameters:
event
- the event instance with previous calendar linkingtarget
- the calendar into which the event must be moved- Returns:
- the updated calendar.
-
deleteAll
public void deleteAll(Calendar calendar)
Description copied from interface:CalendarEventRepository
Deletes all the events that belongs to the specified calendar.- Specified by:
deleteAll
in interfaceCalendarEventRepository
- Parameters:
calendar
- the calendar for which all the events must be deleted.
-
-