Class BlueMindSubscriptionClient

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

@Component @ConditionalOnClass({org.exoplatform.caldav.client.CalDavEndpoint.class,org.exoplatform.caldav.plugin.CalendarShareChannel.class}) public class BlueMindSubscriptionClient extends Object
Edits a colleague's own BlueMind subscriptions through BlueMind's REST API, as that colleague (EXO-90277).

Why a subscription at all. A CS:share writes an access entry and nothing else (SharingProtocol.java); BlueMind's DAV home lists subscriptions, not readable containers (DavStore.java, getCalendarDavResource), and so does its webmail, whose "Add" modal subscribes a readable-but-unsubscribed container with offlineSync=true (SubscribeOtherContainersModal.vue). So a calendar shared from eXo is invisible to the colleague — in eXo and in BlueMind — until somebody subscribes them, and this client does what their "Add" click would.

The call. POST /api/users/{domainUid}/subscriptions/{subject}/_subscribe with a JSON array of {containerUid, offlineSync, automount} (parent/user/net.bluemind.user.api/.../IUserSubscription.java, ContainerSubscription.java); the reverse is _unsubscribe with an array of container uids. The service checks ROLE_MANAGE_USER_SUBSCRIPTIONS or ROLE_SELF on the subject in the container's domain (UserSubscriptionService.java) — the subject's own session, same domain — and no access check: subscribing is a per-user display preference, readable or not. A subscription that already exists is updated, not refused, so the call is idempotent. The answer is a 200 with an empty body; a fault is {errorCode, errorType, message} — 403 for PERMISSION_DENIED, and for an unknown container NOT_FOUND (subscriptionToContainer), which ResponseBuilder.replyServerFault sends as a 500 at BlueMind master and which this client also accepts as a 404, since no capture has yet settled which of the two a live server sends; both are the same absence here.

Whose session, and the one check that guards it. The session is opened with the colleague's stored credentials — the endpoint is minted for their eXo login — because only they may edit their subscriptions. The {domainUid} in the path is not stored anywhere in eXo; it comes from the login answer, as does authUser.uid, and the client refuses before any POST when that uid is not the one it was asked to edit (the library's BlueMindSubjectMismatchException, which the session door hands the host as its CalDavSubjectMismatchException): a principal recorded from a stale discovery, or a colleague reconnected as somebody else, must never make eXo edit another account with a password it holds. The session is still closed by BlueMindCalendarSessions.call(org.exoplatform.caldav.client.CalDavEndpoint, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>).

Same server, the colleague's credentials from storage, one session per job, nothing secret in a message: BlueMindCalendarSessions's rules, shared with every other REST conversation this add-on holds with BlueMind.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
    Whether the subscription is mounted in the colleague's views at once.
    static final boolean
    Whether the subscribed calendar also synchronises to the colleague's devices: BlueMind's own webmail default, and the PO's choice — the calendar reaches their phone as a hand subscription would.
  • Constructor Summary

    Constructors
    Constructor
    Description
    The client Spring builds, over the shared session.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    asSharee(org.exoplatform.caldav.client.CalDavEndpoint shareeEndpoint, String shareeUid, Function<BlueMindSubscriptions,T> job)
    Runs edits of one colleague's subscriptions in one session opened as them, after checking the session is theirs.
    ownersOf(org.exoplatform.caldav.client.CalDavEndpoint accountEndpoint)
    Whose each calendar in an account's view is, read as the account itself (EXO-90347).
    void
    subscribe(org.exoplatform.caldav.client.CalDavEndpoint shareeEndpoint, String shareeUid, String containerUid)
    Subscribes one colleague to one container, in a session of its own.
    void
    unsubscribe(org.exoplatform.caldav.client.CalDavEndpoint shareeEndpoint, String shareeUid, String containerUid)
    Unsubscribes one colleague from one container, in a session of its own.

    Methods inherited from class java.lang.Object

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

    • OFFLINE_SYNC

      public static final boolean OFFLINE_SYNC
      Whether the subscribed calendar also synchronises to the colleague's devices: BlueMind's own webmail default, and the PO's choice — the calendar reaches their phone as a hand subscription would.
      See Also:
    • AUTOMOUNT

      public static final boolean AUTOMOUNT
      Whether the subscription is mounted in the colleague's views at once.
      See Also:
  • Constructor Details

    • BlueMindSubscriptionClient

      @Autowired public BlueMindSubscriptionClient(BlueMindCalendarSessions session)
      The client Spring builds, over the shared session.
      Parameters:
      session - the REST session every BlueMind conversation shares
  • Method Details

    • asSharee

      public <T> T asSharee(org.exoplatform.caldav.client.CalDavEndpoint shareeEndpoint, String shareeUid, Function<BlueMindSubscriptions,T> job)
      Runs edits of one colleague's subscriptions in one session opened as them, after checking the session is theirs.

      One session for several edits is what the drain uses: a colleague owed three subscriptions costs one login, not three.

      Type Parameters:
      T - what the job produces
      Parameters:
      shareeEndpoint - the colleague's DAV endpoint, minted from the registry for their eXo login
      shareeUid - the directory entry uid eXo recorded for them, the segment of their principal
      job - the edits to make
      Returns:
      what the job produced
      Throws:
      IllegalArgumentException - when the uid is blank
      UnsupportedOperationException - when the colleague's configured credentials are not a login and password
      org.exoplatform.caldav.client.CalDavAuthenticationException - when BlueMind refuses the login
      org.exoplatform.caldav.client.CalDavSubjectMismatchException - when BlueMind authenticated somebody other than the recorded uid; nothing was sent
      org.exoplatform.caldav.client.CalDavUnreachableException - when the server cannot be reached
      org.exoplatform.caldav.client.CalDavException - when the login answer names no domain, or a call answers anything else
    • subscribe

      public void subscribe(org.exoplatform.caldav.client.CalDavEndpoint shareeEndpoint, String shareeUid, String containerUid)
      Subscribes one colleague to one container, in a session of its own.
      Parameters:
      shareeEndpoint - the colleague's DAV endpoint, minted for their eXo login
      shareeUid - the directory entry uid eXo recorded for them
      containerUid - the container uid
      Throws:
      org.exoplatform.caldav.client.CalDavException - as asSharee(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.util.function.Function<org.exoplatform.bluemind.calendar.service.BlueMindSubscriptions, T>) and BlueMindSubscriptions.subscribe(java.lang.String) throw
    • unsubscribe

      public void unsubscribe(org.exoplatform.caldav.client.CalDavEndpoint shareeEndpoint, String shareeUid, String containerUid)
      Unsubscribes one colleague from one container, in a session of its own.
      Parameters:
      shareeEndpoint - the colleague's DAV endpoint, minted for their eXo login
      shareeUid - the directory entry uid eXo recorded for them
      containerUid - the container uid
      Throws:
      org.exoplatform.caldav.client.CalDavException - as asSharee(org.exoplatform.caldav.client.CalDavEndpoint, java.lang.String, java.util.function.Function<org.exoplatform.bluemind.calendar.service.BlueMindSubscriptions, T>) and BlueMindSubscriptions.unsubscribe(java.lang.String) throw
    • ownersOf

      public BlueMindCalendarOwners ownersOf(org.exoplatform.caldav.client.CalDavEndpoint accountEndpoint)
      Whose each calendar in an account's view is, read as the account itself (EXO-90347).

      GET /api/users/{domainUid}/subscriptions/{uid}?type=calendar (IUserSubscription.listSubscriptions), in a session opened with the account's stored credentials, addressed to the uid BlueMind authenticated that session as — never a uid a caller names, so the listing read is by construction the account's own. The answer is a JSON array of ContainerSubscriptionDescriptor, of which two members are read: containerUid and owner; an entry lacking either is skipped. Captured live on 2026-09-16 (bluemind-rest-subscriptions-after-subscribe.captured.json): the account's own calendars carry its uid as owner, a colleague's shared calendar carries the colleague's, a pool vehicle carries the resource's.

      The same session rules as every other call here: same server, the account's credentials from storage, one session per call, closed afterwards, nothing secret in a message.

      Parameters:
      accountEndpoint - the account's DAV endpoint, minted from the registry for the user's eXo login
      Returns:
      the authenticated uid and the owner of every listed calendar
      Throws:
      UnsupportedOperationException - when the account's configured credentials are not a login and password
      org.exoplatform.caldav.client.CalDavAuthenticationException - when BlueMind refuses the login or the session
      org.exoplatform.caldav.client.CalDavForbiddenException - when BlueMind refuses the listing
      org.exoplatform.caldav.client.CalDavUnreachableException - when the server cannot be reached
      org.exoplatform.caldav.client.CalDavException - when the login names no uid or no domain, or the answer is anything but a JSON array