Class BlueMindCalendarImportClient

java.lang.Object
org.exoplatform.bluemind.calendar.service.BlueMindCalendarImportClient

@Component @ConditionalOnClass({org.exoplatform.caldav.client.CalDavEndpoint.class,org.exoplatform.caldav.plugin.CalendarShareChannel.class}) public class BlueMindCalendarImportClient extends Object
Writes and removes calendar objects through BlueMind's own calendar REST API — the door whose every change carries sendNotification=false (EXO-90307).

What is called, and why it is safe to call (verified in BlueMind's source, bluemind-public master):

  • Import: PUT /api/calendars/vevent/{containerUid}, the raw ICS as the body (IVEvent.java:31,53; a Stream parameter is read as the raw body whatever the media type, DefaultBodyParameterCodecs.StreamBodyCodec). The service runs MultipleCalendarICSImport in Mode.IMPORT (VEventService.java:114-116) — never Mode.SYNC, which would delete everything the file does not carry (ICSImportTask.java:90-103). Each series is matched by ICS UID, merged, and applied with sendNotification=false on the add, the modify and the delete of an attendee-side series (EventChangesMerge.java:102,238,240), so IcsHook.mustSendNotification returns before any REQUEST, UPDATE, CANCEL or REPLY is built (IcsHook.java:1099-1117).
  • Its answer is a task: a TaskRef whose status is read at GET /api/tasks/{id} (ITask.java) until state.ended. The task's result is the first end the monitor received (TaskMonitor.java:85-92 ignores a second one), and in import mode that is an ImportStats — uids of what was added or updated, total of everything the file carried, unhandled included (ICSImportTask.java:83-89). A UID missing from uids was not written, whatever the HTTP status said.
  • Removal: DELETE /api/calendars/{containerUid}/{uid}?sendNotifications=false (ICalendar.java:125-128).
  • Faults are {errorCode, errorType, message} bodies: 500, or 403 for PERMISSION_DENIED (ResponseBuilder.java:70-76); a dead session is 401 (RestResponse.invalidSession).

Bounded waiting, never a hang: the task is polled at a fixed interval until it ends or a deadline passes, and a task still running at the deadline is a failed write — the caller's sweep retries it, and the import is idempotent by UID so a retry over a late success changes nothing.

Within the caller's budget: when the caller opened one on its thread — the landing of a mail's invitation does (CalDavDeadline) — every exchange waits the smaller of the client's request timeout and the time left, the task is polled no longer than that time, nothing is sent once it is spent, and the call then fails with a CalDavDeadlineException.

  • Field Details

    • IMPORT_TIMEOUT_PROPERTY

      public static final String IMPORT_TIMEOUT_PROPERTY
      The deployment property bounding the wait for one import task, in seconds.
      See Also:
  • Constructor Details

    • BlueMindCalendarImportClient

      @Autowired public BlueMindCalendarImportClient(BlueMindCalendarSessions session)
      The client Spring builds: real sleeps, the system clock, the configured deadline.
      Parameters:
      session - the REST session every BlueMind conversation shares
  • Method Details

    • importIcs

      public BlueMindImportReport importIcs(org.exoplatform.caldav.client.CalDavEndpoint endpoint, String containerUid, String ics)
      Imports one ICS document into a calendar container and waits for BlueMind to finish applying it.
      Parameters:
      endpoint - the account's DAV endpoint, minted from the registry
      containerUid - the calendar container, the last segment of the collection's path
      ics - the iCalendar text, exactly as it should be applied
      Returns:
      what the task reported
      Throws:
      IllegalArgumentException - when the container or the document is blank
      org.exoplatform.caldav.client.CalDavAuthenticationException - when BlueMind refuses the login or the session
      org.exoplatform.caldav.client.CalDavForbiddenException - when the account may not write the container
      org.exoplatform.caldav.client.CalDavException - when the import is refused, ends in error, or does not end within the deadline
    • deleteEvent

      public int deleteEvent(org.exoplatform.caldav.client.CalDavEndpoint endpoint, String containerUid, String uid)
      Removes one series from a calendar container without notifying anybody.
      Parameters:
      endpoint - the account's DAV endpoint, minted from the registry
      containerUid - the calendar container
      uid - the item uid, which is the ICS UID
      Returns:
      204 when removed — or when BlueMind holds no such item, which its calendar service only logs (CalendarService.java:466-471); 404 when the container itself is unknown (CalendarServiceBaseFactory.java:60)
      Throws:
      IllegalArgumentException - when the container or the uid is blank
      org.exoplatform.caldav.client.CalDavAuthenticationException - when BlueMind refuses the login or the session
      org.exoplatform.caldav.client.CalDavForbiddenException - when the account may not write the container
      org.exoplatform.caldav.client.CalDavException - when the removal is refused for any other reason