Class CaldavReadService

java.lang.Object
org.exoplatform.caldav.service.CaldavReadService

@Service public class CaldavReadService extends Object
Reads the connected account's calendars server-side, so the page receives mapped events instead of downloading and parsing every iCalendar object in the main thread.

One REPORT per calendar per request, bounded by how many calendars the account holds — a handful. Not one per event: that is the shape this replaces.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.exoplatform.caldav.model.RemoteCalendarsRead
    listCalendars(long userIdentityId)
    The calendars of the connected account, and whether the account could be asked at all.
    org.exoplatform.caldav.model.RemoteEventsRead
    readEvents(long userIdentityId, Instant start, Instant end)
    The events of the connected account over a window, one calendar at a time, and which part of that reading failed.

    Methods inherited from class java.lang.Object

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

    • CaldavReadService

      public CaldavReadService()
  • Method Details

    • listCalendars

      public org.exoplatform.caldav.model.RemoteCalendarsRead listCalendars(long userIdentityId)
      The calendars of the connected account, and whether the account could be asked at all.

      The failure travels in the answer rather than as an exception. A caller that receives a bare empty list cannot tell an account holding no calendar from an account whose server is down, and the second is the case that actually happens — so it is said, next to the list, instead of being left in a log line no browser reads.

      Parameters:
      userIdentityId - identity of the user
      Returns:
      the calendars, each with a usable colour, and the flag saying whether the listing failed; empty and unfailed when no account is connected
    • readEvents

      public org.exoplatform.caldav.model.RemoteEventsRead readEvents(long userIdentityId, Instant start, Instant end)
      The events of the connected account over a window, one calendar at a time, and which part of that reading failed.

      A calendar that fails degrades to no events for that calendar, exactly as the browser's Promise.allSettled did: one collection a server refuses, or one object it cannot serialise, must not blank the whole agenda. The failure is still not raised, because the user's remaining calendars are worth showing — but it is now reported, in the answer, because a caller handed only the surviving events draws them as the whole truth and says nothing is missing.

      Two grains, matching the two ways a read fails. The account could not be asked at all — nothing was read, and the empty list is not an answer about the user's week. Or the account answered and some of its collections did not, in which case the events of the others are returned and only the failed hrefs are named.

      Parameters:
      userIdentityId - identity of the user
      start - beginning of the window
      end - end of the window
      Returns:
      the occurrences, each tagged with the calendar it came from, beside the flag and the hrefs that say what was not read