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; aStreamparameter is read as the raw body whatever the media type,DefaultBodyParameterCodecs.StreamBodyCodec). The service runsMultipleCalendarICSImportinMode.IMPORT(VEventService.java:114-116) — neverMode.SYNC, which would delete everything the file does not carry (ICSImportTask.java:90-103). Each series is matched by ICS UID, merged, and applied withsendNotification=falseon the add, the modify and the delete of an attendee-side series (EventChangesMerge.java:102,238,240), soIcsHook.mustSendNotificationreturns before any REQUEST, UPDATE, CANCEL or REPLY is built (IcsHook.java:1099-1117). - Its answer is a task: a
TaskRefwhose status is read atGET /api/tasks/{id}(ITask.java) untilstate.ended. The task's result is the firstendthe monitor received (TaskMonitor.java:85-92ignores a second one), and in import mode that is anImportStats—uidsof what was added or updated,totalof everything the file carried, unhandled included (ICSImportTask.java:83-89). A UID missing fromuidswas 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 forPERMISSION_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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe deployment property bounding the wait for one import task, in seconds. -
Constructor Summary
ConstructorsConstructorDescriptionThe client Spring builds: real sleeps, the system clock, the configured deadline. -
Method Summary
Modifier and TypeMethodDescriptionintdeleteEvent(org.exoplatform.caldav.client.CalDavEndpoint endpoint, String containerUid, String uid) Removes one series from a calendar container without notifying anybody.Imports one ICS document into a calendar container and waits for BlueMind to finish applying it.
-
Field Details
-
IMPORT_TIMEOUT_PROPERTY
The deployment property bounding the wait for one import task, in seconds.- See Also:
-
-
Constructor Details
-
BlueMindCalendarImportClient
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 registrycontainerUid- the calendar container, the last segment of the collection's pathics- the iCalendar text, exactly as it should be applied- Returns:
- what the task reported
- Throws:
IllegalArgumentException- when the container or the document is blankorg.exoplatform.caldav.client.CalDavAuthenticationException- when BlueMind refuses the login or the sessionorg.exoplatform.caldav.client.CalDavForbiddenException- when the account may not write the containerorg.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 registrycontainerUid- the calendar containeruid- 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 blankorg.exoplatform.caldav.client.CalDavAuthenticationException- when BlueMind refuses the login or the sessionorg.exoplatform.caldav.client.CalDavForbiddenException- when the account may not write the containerorg.exoplatform.caldav.client.CalDavException- when the removal is refused for any other reason
-