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 Type
    Method
    Description
    countByCalendarOfOwner(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, as CalendarLinkDAO.findByCalendarOwnerIds does.
    int
    deleteByCalendarId(long calendarId)
    Deletes every share of a calendar.
    int
    deleteByCalendarOwner(long ownerId)
    Deletes every share of every calendar an owner has.
    int
    deleteByShareeIdentityId(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, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByCalendarIdAndShareeIdentityId

      CalendarShareEntity findByCalendarIdAndShareeIdentityId(long calendarId, long shareeIdentityId)
      Finds the share of a calendar with a colleague.
      Parameters:
      calendarId - technical identifier of the calendar
      shareeIdentityId - identity identifier of the colleague
      Returns:
      the share, or null when the calendar is not shared with them
    • 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 calendar
      pageable - the page to read
      Returns:
      the shares
    • findByShareeIdentityIdOrderByCreatedDateDescIdDesc

      List<CalendarShareEntity> findByShareeIdentityIdOrderByCreatedDateDescIdDesc(long shareeIdentityId, org.springframework.data.domain.Pageable pageable)
      The shares a colleague received, newest first.
      Parameters:
      shareeIdentityId - identity identifier of the colleague
      pageable - the page to read
      Returns:
      the shares
    • findCalendarLevelsByShareeIdentityId

      @Query("SELECT share.calendarId, share.level FROM AgendaCalendarShare share WHERE share.shareeIdentityId = :shareeIdentityId") List<Object[]> findCalendarLevelsByShareeIdentityId(@Param("shareeIdentityId") 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. Answered as rows rather than as a constructor expression so the projection stays a plain JPQL select the engine parses on any dialect.
      Parameters:
      shareeIdentityId - identity identifier of the colleague
      Returns:
      one [calendarId, level] row per share
    • 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, as CalendarLinkDAO.findByCalendarOwnerIds does.
      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 calendars
      deliveredTo - 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
    • deleteByShareeIdentityId

      @Transactional @Modifying(clearAutomatically=true, flushAutomatically=true) @Query("DELETE FROM AgendaCalendarShare share WHERE share.shareeIdentityId = :shareeIdentityId") int deleteByShareeIdentityId(@Param("shareeIdentityId") long shareeIdentityId)
      Deletes every share a colleague received.
      Parameters:
      shareeIdentityId - identity identifier of the colleague
      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