Class CalendarShareStorage
CalendarShare, and
caches the two reads every ACL decision relies on (EXO-90357).
Two caches, both keyed by one explicit identifier. "agenda.calendarShare.byViewer" holds, per reader identity, the calendars shared with them and the level of each share (EXO-90378): what every event and calendar read asks, and what every write path asks too, once per request, on the reader's own key — a viewer is never served another's map, and the level is a field of the cached value, never folded into its key. "agenda.calendarShare.byCalendar" holds, per calendar, its shares: what the owner's drawer and the delivery reads ask. A write evicts exactly the keys it touches, so a revoke makes the refusal immediate; the bulk deletions that cannot name their keys evict the whole cache, which they may — they run on a calendar or a user being deleted.
The cached reads are reached through a lazy self-reference from the other
methods of this bean: a plain this call bypasses the proxy and,
silently, the cache.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintclearDelivery(long ownerIdentityId, String channelId) Forgets that a channel carries the shares of an owner's calendars.countShareesByCalendar(long ownerIdentityId) How many colleagues each calendar of an owner is shared with, from one query.booleandelete(long calendarId, long shareeIdentityId) Deletes the share of a calendar with one colleague.intdeleteByCalendarId(long calendarId) Deletes every share of a calendar.intdeleteOfUser(long identityId) Deletes every share a colleague received, and every share of the calendars they own.org.exoplatform.agenda.model.CalendarSharegetShare(long calendarId, long shareeIdentityId) The share of a calendar with one colleague, read through the calendar's cached shares.getSharedCalendarIds(long viewerIdentityId) The identifiers of every calendar shared with a reader, derived from the cached level map.org.exoplatform.agenda.constant.CalendarShareLevelgetShareLevel(long calendarId, long viewerIdentityId) The level a calendar is shared with a reader at: one cache hit on the reader's key.getShareLevels(long viewerIdentityId) Every calendar shared with a reader and the level it is shared at (EXO-90378).List<org.exoplatform.agenda.model.CalendarShare> getShares(long calendarId) The shares of a calendar, oldest first.List<org.exoplatform.agenda.model.CalendarShare> getSharesOfSharee(long shareeIdentityId, int limit) The shares a colleague received, newest first.booleanisSharedWith(long calendarId, long viewerIdentityId) Whether a calendar is shared with a reader: one cache hit on the reader's key.org.exoplatform.agenda.model.CalendarSharesave(long calendarId, long shareeIdentityId, long grantedById, org.exoplatform.agenda.constant.CalendarShareLevel level, org.exoplatform.agenda.constant.CalendarShareSource source, String deliveredTo, String deliveryRef, Date createdDate) Writes a new share.org.exoplatform.agenda.model.CalendarSharesetDelivery(long calendarId, long shareeIdentityId, String deliveredTo, String deliveryRef) Records which channel carries a share, and under which reference; null both to record that none does.org.exoplatform.agenda.model.CalendarSharesetHidden(long calendarId, long shareeIdentityId, boolean hidden) Records the sharee's choice to hide the calendar, or to show it again.org.exoplatform.agenda.model.CalendarSharesetLevel(long calendarId, long shareeIdentityId, org.exoplatform.agenda.constant.CalendarShareLevel level) Records what a colleague may do with the calendar (EXO-90378).voidsetSelf(CalendarShareStorage self) Receives the proxied bean, so that the methods of this class reach the cached reads through the cache rather than throughthis.
-
Field Details
-
BY_VIEWER_CACHE
Cache of the calendar identifiers shared with a reader, keyed by reader identity id.- See Also:
-
BY_CALENDAR_CACHE
Cache of the shares of a calendar, keyed by calendar id.- See Also:
-
MAX_SHARES
public static final int MAX_SHARESMost shares one calendar listing reads.- See Also:
-
-
Constructor Details
-
Method Details
-
setDelivery
@CacheEvict(cacheNames="agenda.calendarShare.byViewer",key="#shareeIdentityId") @CacheEvict(cacheNames="agenda.calendarShare.byCalendar",key="#calendarId") public org.exoplatform.agenda.model.CalendarShare setDelivery(long calendarId, long shareeIdentityId, String deliveredTo, String deliveryRef) Records which channel carries a share, and under which reference; null both to record that none does.- Parameters:
calendarId- technical identifier of the calendarshareeIdentityId- identity identifier of the colleaguedeliveredTo- the channel, or nulldeliveryRef- the channel's reference, or null- Returns:
- the updated share, or null when there is no such share
-
setHidden
@CacheEvict(cacheNames="agenda.calendarShare.byViewer",key="#shareeIdentityId") @CacheEvict(cacheNames="agenda.calendarShare.byCalendar",key="#calendarId") public org.exoplatform.agenda.model.CalendarShare setHidden(long calendarId, long shareeIdentityId, boolean hidden) Records the sharee's choice to hide the calendar, or to show it again.- Parameters:
calendarId- technical identifier of the calendarshareeIdentityId- identity identifier of the colleaguehidden- whether hidden- Returns:
- the updated share, or null when there is no such share
-
delete
@CacheEvict(cacheNames="agenda.calendarShare.byViewer",key="#shareeIdentityId") @CacheEvict(cacheNames="agenda.calendarShare.byCalendar",key="#calendarId") public boolean delete(long calendarId, long shareeIdentityId) Deletes the share of a calendar with one colleague.- Parameters:
calendarId- technical identifier of the calendarshareeIdentityId- identity identifier of the colleague- Returns:
- true when a share was deleted
-
deleteByCalendarId
@CacheEvict(cacheNames="agenda.calendarShare.byViewer",allEntries=true) @CacheEvict(cacheNames="agenda.calendarShare.byCalendar",key="#calendarId") public int deleteByCalendarId(long calendarId) Deletes every share of a calendar. The sharees are not read first, so every reader's cached list is dropped.- Parameters:
calendarId- technical identifier of the calendar- Returns:
- how many shares went
-
deleteOfUser
@CacheEvict(cacheNames="agenda.calendarShare.byViewer",allEntries=true) @CacheEvict(cacheNames="agenda.calendarShare.byCalendar",allEntries=true) public int deleteOfUser(long identityId) Deletes every share a colleague received, and every share of the calendars they own.- Parameters:
identityId- identity identifier of the user- Returns:
- how many shares went
-
clearDelivery
@CacheEvict(cacheNames="agenda.calendarShare.byViewer",allEntries=true) @CacheEvict(cacheNames="agenda.calendarShare.byCalendar",allEntries=true) public int clearDelivery(long ownerIdentityId, String channelId) Forgets that a channel carries the shares of an owner's calendars.- Parameters:
ownerIdentityId- identity identifier of the ownerchannelId- the channel- Returns:
- how many shares were cleared