Package org.exoplatform.agenda.dao
Interface CalendarShareDAO
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<CalendarShareEntity,,Long> org.springframework.data.jpa.repository.JpaRepository<CalendarShareEntity,,Long> org.springframework.data.repository.ListCrudRepository<CalendarShareEntity,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<CalendarShareEntity,,Long> org.springframework.data.repository.PagingAndSortingRepository<CalendarShareEntity,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<CalendarShareEntity>,org.springframework.data.repository.Repository<CalendarShareEntity,Long>
public interface CalendarShareDAO
extends org.springframework.data.jpa.repository.JpaRepository<CalendarShareEntity,Long>
Reads and writes calendar shares (EXO-90357). The single-row lookup hits the
unique key and needs no page; the listings take one.
-
Method Summary
Modifier and TypeMethodDescriptioncountByCalendarOfOwner(long ownerId) How many colleagues each calendar of an owner is shared with, in one statement: the shares joined to their calendars and filtered on the calendars' owner, asCalendarLinkDAO.findByCalendarOwnerIdsdoes.intdeleteByCalendarId(long calendarId) Deletes every share of a calendar.intdeleteByCalendarOwner(long ownerId) Deletes every share of every calendar an owner has.intdeleteByShareeIdentityId(long shareeIdentityId) Deletes every share a colleague received.findByCalendarIdAndShareeIdentityId(long calendarId, long shareeIdentityId) Finds the share of a calendar with a colleague.findByCalendarIdOrderByCreatedDateAscIdAsc(long calendarId, org.springframework.data.domain.Pageable pageable) The shares of a calendar, oldest first.findByCalendarOwnerAndDeliveredTo(long ownerId, String deliveredTo) The shares of every calendar an owner has, delivered through a channel.findByShareeIdentityIdOrderByCreatedDateDescIdDesc(long shareeIdentityId, org.springframework.data.domain.Pageable pageable) The shares a colleague received, newest first.findCalendarLevelsByShareeIdentityId(long shareeIdentityId) Every calendar shared with a colleague and the level it is shared at (EXO-90378): what the ACL of every read and every write relies on, so the two columns only and one statement, served by the same sharee index as the identifiers above.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByCalendarIdOrderByCreatedDateAscIdAsc
List<CalendarShareEntity> findByCalendarIdOrderByCreatedDateAscIdAsc(long calendarId, org.springframework.data.domain.Pageable pageable) The shares of a calendar, oldest first.- Parameters:
calendarId- technical identifier of the calendarpageable- the page to read- Returns:
- the shares
-
countByCalendarOfOwner
@Query("SELECT share.calendarId, COUNT(share) FROM AgendaCalendarShare share, AgendaCalendar calendar WHERE calendar.id = share.calendarId AND calendar.ownerId = :ownerId GROUP BY share.calendarId") List<Object[]> countByCalendarOfOwner(@Param("ownerId") long ownerId) How many colleagues each calendar of an owner is shared with, in one statement: the shares joined to their calendars and filtered on the calendars' owner, asCalendarLinkDAO.findByCalendarOwnerIdsdoes.- Parameters:
ownerId- identity identifier owning the calendars- Returns:
- one
[calendarId, count]row per shared calendar
-
findByCalendarOwnerAndDeliveredTo
@Query("SELECT share FROM AgendaCalendarShare share, AgendaCalendar calendar WHERE calendar.id = share.calendarId AND calendar.ownerId = :ownerId AND share.deliveredTo = :deliveredTo") List<CalendarShareEntity> findByCalendarOwnerAndDeliveredTo(@Param("ownerId") long ownerId, @Param("deliveredTo") String deliveredTo) The shares of every calendar an owner has, delivered through a channel.- Parameters:
ownerId- identity identifier owning the calendarsdeliveredTo- the channel- Returns:
- the shares
-
deleteByCalendarId
@Transactional @Modifying(clearAutomatically=true, flushAutomatically=true) @Query("DELETE FROM AgendaCalendarShare share WHERE share.calendarId = :calendarId") int deleteByCalendarId(@Param("calendarId") long calendarId) Deletes every share of a calendar.- Parameters:
calendarId- technical identifier of the calendar- Returns:
- how many rows went
-
deleteByCalendarOwner
@Transactional @Modifying(clearAutomatically=true, flushAutomatically=true) @Query("DELETE FROM AgendaCalendarShare share WHERE share.calendarId IN (SELECT calendar.id FROM AgendaCalendar calendar WHERE calendar.ownerId = :ownerId)") int deleteByCalendarOwner(@Param("ownerId") long ownerId) Deletes every share of every calendar an owner has.- Parameters:
ownerId- identity identifier owning the calendars- Returns:
- how many rows went