Class CalendarShareAccess

java.lang.Object
org.exoplatform.agenda.service.CalendarShareAccess

public class CalendarShareAccess extends Object
How agenda's Kernel-wired services reach the Spring-wired AgendaCalendarShareService (EXO-90357).

AgendaCalendarServiceImpl and AgendaEventServiceImpl are Kernel components built from configuration.xml; the share service is a Spring bean, exported to the Kernel by the bridge once its context is up. A constructor dependency is impossible in that direction, so the bean is looked up the first time it is needed, as AgendaEventReminderServiceImpl looks up the calendar service.

Absent means not shared, never allowed. Every answer here widens an ACL: a lookup that fails, a bean that is not there yet, an exception inside it, all read as "no share", so that nothing this class cannot establish ever lets a reader through. Since EXO-90378 the same rule carries the level: a level that cannot be established is no level at all — null, not CalendarShareLevel.VIEW — so an unreachable share service admits no reader and, a fortiori, no writer.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Builds a lookup that resolves the bean on first use.
    CalendarShareAccess(org.exoplatform.agenda.service.AgendaCalendarShareService calendarShareService)
    Builds a lookup over a known service, for tests and for the Spring side.
  • Method Summary

    Modifier and Type
    Method
    Description
    getSharedCalendarIds(long identityId)
    The calendars shared with an identity.
    boolean
    isSharedForEditWith(long calendarId, long identityId)
    Whether a calendar is shared with an identity at the level that lets them write events in it.
    boolean
    isSharedWith(long calendarId, long identityId)
    Whether a calendar is shared with an identity.
    org.exoplatform.agenda.constant.CalendarShareLevel
    levelOf(long calendarId, long identityId)
    The level a calendar is shared with an identity at (EXO-90378).
    Map<Long,org.exoplatform.agenda.constant.CalendarShareLevel>
    levelsOf(long identityId)
    Every calendar shared with an identity and the level of each (EXO-90378): what a listing asks once instead of asking per event.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CalendarShareAccess

      public CalendarShareAccess()
      Builds a lookup that resolves the bean on first use.
    • CalendarShareAccess

      public CalendarShareAccess(org.exoplatform.agenda.service.AgendaCalendarShareService calendarShareService)
      Builds a lookup over a known service, for tests and for the Spring side.
      Parameters:
      calendarShareService - the share service, may be null
  • Method Details

    • isSharedWith

      public boolean isSharedWith(long calendarId, long identityId)
      Whether a calendar is shared with an identity.
      Parameters:
      calendarId - technical identifier of the calendar
      identityId - identity identifier of the reader
      Returns:
      true only when the share service says so
    • levelOf

      public org.exoplatform.agenda.constant.CalendarShareLevel levelOf(long calendarId, long identityId)
      The level a calendar is shared with an identity at (EXO-90378).
      Parameters:
      calendarId - technical identifier of the calendar
      identityId - identity identifier of the reader
      Returns:
      the level, or null when the calendar is not shared with them or the share service cannot say
    • isSharedForEditWith

      public boolean isSharedForEditWith(long calendarId, long identityId)
      Whether a calendar is shared with an identity at the level that lets them write events in it. The one question every write path of AgendaEventServiceImpl asks of a share.
      Parameters:
      calendarId - technical identifier of the calendar
      identityId - identity identifier of the user
      Returns:
      true only when the share service says the level is CalendarShareLevel.EDIT
    • levelsOf

      public Map<Long,org.exoplatform.agenda.constant.CalendarShareLevel> levelsOf(long identityId)
      Every calendar shared with an identity and the level of each (EXO-90378): what a listing asks once instead of asking per event.
      Parameters:
      identityId - identity identifier of the reader
      Returns:
      the levels by calendar identifier, empty when none or when they cannot be read
    • getSharedCalendarIds

      public List<Long> getSharedCalendarIds(long identityId)
      The calendars shared with an identity.
      Parameters:
      identityId - identity identifier of the reader
      Returns:
      the calendar identifiers, empty when none or when they cannot be read