Class CaldavConnectorStorage

java.lang.Object
org.exoplatform.caldav.storage.CaldavConnectorStorage

public class CaldavConnectorStorage extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    CaldavConnectorStorage(org.exoplatform.commons.api.settings.SettingService settingService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    createCaldavSetting(org.exoplatform.caldav.model.CaldavUserSetting caldavUserSetting, long userIdentityId)
    Stores the credentials of the connected CalDAV account of a user and, when the account was connected through a declared server registration, the identifier of that registration.
    void
    deleteCaldavSetting(long userIdentityId)
    Deletes every stored CalDAV setting of a user: credentials and mirror calendar href alike, so a later reconnection starts from a clean state and never silently reuses the mirror of a previous account.
    void
    forgetMirrorCalendarHref(long userIdentityId)
    Forgets the href of the mirror calendar of a user, leaving the rest of their account alone (EXO-90398).
    org.exoplatform.caldav.model.CaldavUserSetting
    getCaldavSetting(long userIdentityId)
    Retrieves the CalDAV settings of a user: the credentials of the connected account and, when one has been established, the href of the mirror calendar.
    The users whose CalDAV connection managed mode made, by one query on the mark - no user setting is read.
    boolean
    isConnectedByManagedMode(long userIdentityId)
    Whether managed mode made this user's CalDAV connection.
    void
    markConnectedByManagedMode(long userIdentityId, boolean byManagedMode)
    Records, or clears, that managed mode made this user's CalDAV connection.
    void
    saveMirrorCalendarHref(String mirrorCalendarHref, long userIdentityId)
    Saves the href of the mirror calendar of a user, the remote collection every meeting pushed by eXo is written to.

    Methods inherited from class java.lang.Object

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

    • CaldavConnectorStorage

      public CaldavConnectorStorage(org.exoplatform.commons.api.settings.SettingService settingService)
  • Method Details

    • createCaldavSetting

      public void createCaldavSetting(org.exoplatform.caldav.model.CaldavUserSetting caldavUserSetting, long userIdentityId)
      Stores the credentials of the connected CalDAV account of a user and, when the account was connected through a declared server registration, the identifier of that registration. A connection made outside any registration (the legacy single-server deployment) removes a previously stored reference rather than leaving a stale one pointing the new account at the old server.
      Parameters:
      caldavUserSetting - setting holding the credentials and, optionally, the server registration identifier
      userIdentityId - technical identity identifier of the user
    • saveMirrorCalendarHref

      public void saveMirrorCalendarHref(String mirrorCalendarHref, long userIdentityId)
      Saves the href of the mirror calendar of a user, the remote collection every meeting pushed by eXo is written to. The href is stored beside the other settings of the CalDAV account of that user, so disconnecting the account removes it with the rest.
      Parameters:
      mirrorCalendarHref - href of the mirror calendar collection
      userIdentityId - technical identity identifier of the user
    • forgetMirrorCalendarHref

      public void forgetMirrorCalendarHref(long userIdentityId)
      Forgets the href of the mirror calendar of a user, leaving the rest of their account alone (EXO-90398).

      What a connection naming another account, or another server, calls: the collection recorded under the previous credentials is not this account's, and a reader of the record — the Share drawer, which warns when the calendar being shared is where the copies go — would otherwise be reading somebody else's destination. The same reasoning deleteCaldavSetting(long) states for a disconnection, applied to the one case that is not one: re-connecting over an account that was never disconnected.

      The account's half of the record, and deliberately only that half. The Share drawer reads a union of this href and the mirror pair's remoteHref, and the pair — keyed on the user and the server — is left where it is. On a connection naming another server that costs nothing: the pairs of the server just left are not read for the one the account is now on. On another mailbox of the same server the pair survives and keeps naming the collection the previous account's copies went into, so the drawer warns about a calendar the new account may not even see. That is the cheap direction — a warning too many, not one too few — and the push repoints the pair on its next write, which is why nothing removes it here.

      Never on its own: the connection re-establishes the destination in the same request, so the record is absent only for as long as that takes, and an absent record is asked of the server rather than read as "no copies here".

      Parameters:
      userIdentityId - technical identity identifier of the user
    • getCaldavSetting

      public org.exoplatform.caldav.model.CaldavUserSetting getCaldavSetting(long userIdentityId)
      Retrieves the CalDAV settings of a user: the credentials of the connected account and, when one has been established, the href of the mirror calendar.
      Parameters:
      userIdentityId - technical identity identifier of the user
      Returns:
      the CaldavUserSetting of that user, never null
    • deleteCaldavSetting

      public void deleteCaldavSetting(long userIdentityId)
      Deletes every stored CalDAV setting of a user: credentials and mirror calendar href alike, so a later reconnection starts from a clean state and never silently reuses the mirror of a previous account.
      Parameters:
      userIdentityId - technical identity identifier of the user
    • markConnectedByManagedMode

      public void markConnectedByManagedMode(long userIdentityId, boolean byManagedMode)
      Records, or clears, that managed mode made this user's CalDAV connection.
      Parameters:
      userIdentityId - technical identity identifier of the user
      byManagedMode - true to mark the connection, false to clear the mark
    • isConnectedByManagedMode

      public boolean isConnectedByManagedMode(long userIdentityId)
      Whether managed mode made this user's CalDAV connection.
      Parameters:
      userIdentityId - technical identity identifier of the user
      Returns:
      true when managed mode made it and the user has not connected since
    • getIdentitiesConnectedByManagedMode

      public List<Long> getIdentitiesConnectedByManagedMode()
      The users whose CalDAV connection managed mode made, by one query on the mark - no user setting is read.
      Returns:
      their technical identity identifiers