Class AgendaUserSettings

java.lang.Object
org.exoplatform.agenda.model.AgendaUserSettings
All Implemented Interfaces:
Cloneable

public class AgendaUserSettings extends Object implements Cloneable
  • Constructor Summary

    Constructors
    Constructor
    Description
    AgendaUserSettings(String cometdToken, String agendaDefaultView, String agendaWeekStartOn, boolean showWorkingTime, String workingTimeStart, String workingTimeEnd, String connectedRemoteProvider, String connectedRemoteUserId, boolean automaticPushEvents, String timeZoneId, String workedDaysNumber, boolean showRemoteEventsForTimeLine)
    Builds the settings from their scalar fields — what clone() copies.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addOrUpdateConnectedConnector(String providerName, String remoteUserId)
    Adds the account held on the given provider, or updates its remote user id when the provider already holds one: a user keeps at most one account per provider, so connecting again with another account replaces the previous one rather than accumulating.
    Clones these settings, deep-copying the connected accounts so that mutating an account on the clone never alters the original — the default settings template is cloned per user, and a shared list would leak one user's accounts into another's defaults.
     
    Returns every remote account the user holds, lazily mapping the legacy single-connector fields into the list: a blob written before several accounts could coexist carries only connectedRemoteProvider and connectedRemoteUserId, and its one account materialises here as a one-entry list the first time the list is read.
    void
    Removes the account held on the given provider, leaving the other connected accounts untouched.
    Serialises this object to the JSON blob persisted in the settings store.

    Methods inherited from class java.lang.Object

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

    • AgendaUserSettings

      public AgendaUserSettings(String cometdToken, String agendaDefaultView, String agendaWeekStartOn, boolean showWorkingTime, String workingTimeStart, String workingTimeEnd, String connectedRemoteProvider, String connectedRemoteUserId, boolean automaticPushEvents, String timeZoneId, String workedDaysNumber, boolean showRemoteEventsForTimeLine)
      Builds the settings from their scalar fields — what clone() copies. The showRemoteEventsForAgenda flag this constructor used to carry is retired: remote events are fetched whenever an account is connected, and what is shown is decided per calendar in the agenda's left panel. The timeline keeps its own flag, whose default hides remote events there.
      Parameters:
      cometdToken - token authenticating the cometd channel
      agendaDefaultView - view type the agenda opens on
      agendaWeekStartOn - day the displayed weeks start on
      showWorkingTime - whether the working-time frame is highlighted
      workingTimeStart - start hour of the working-time frame
      workingTimeEnd - end hour of the working-time frame
      connectedRemoteProvider - legacy mirror of the first connected account's provider name
      connectedRemoteUserId - legacy mirror of the first connected account's remote user id
      automaticPushEvents - whether eXo events are pushed to the connected account without asking
      timeZoneId - identifier of the user's time zone
      workedDaysNumber - number of days the working week counts
      showRemoteEventsForTimeLine - whether the timeline widget shows remote events
  • Method Details

    • getConnectedConnectors

      public List<AgendaConnectorAccount> getConnectedConnectors()
      Returns every remote account the user holds, lazily mapping the legacy single-connector fields into the list: a blob written before several accounts could coexist carries only connectedRemoteProvider and connectedRemoteUserId, and its one account materialises here as a one-entry list the first time the list is read. This getter is also what the JSON serialisation reads, so a legacy blob re-saved untouched is written in the new shape (while the legacy fields keep mirroring the first entry for downgrade safety). Never returns null.
      Returns:
      the mutable list of connected accounts, possibly empty
    • addOrUpdateConnectedConnector

      public void addOrUpdateConnectedConnector(String providerName, String remoteUserId)
      Adds the account held on the given provider, or updates its remote user id when the provider already holds one: a user keeps at most one account per provider, so connecting again with another account replaces the previous one rather than accumulating. A newly added account receives copies by default; an updated one keeps the opt-out the user may have chosen.
      Parameters:
      providerName - name of the remote provider the account is held on
      remoteUserId - identifier of the user on the remote provider
    • removeConnectedConnector

      public void removeConnectedConnector(String providerName)
      Removes the account held on the given provider, leaving the other connected accounts untouched. A blank provider name removes every account, which is the behaviour the reset endpoint had when only one account could exist.
      Parameters:
      providerName - name of the remote provider to disconnect, or blank to disconnect them all
    • toString

      public String toString()
      Serialises this object to the JSON blob persisted in the settings store.
      Overrides:
      toString in class Object
      Returns:
      the JSON representation of these settings
    • fromString

      public static AgendaUserSettings fromString(String value)
    • clone

      public AgendaUserSettings clone()
      Clones these settings, deep-copying the connected accounts so that mutating an account on the clone never alters the original — the default settings template is cloned per user, and a shared list would leak one user's accounts into another's defaults.
      Overrides:
      clone in class Object
      Returns:
      an independent copy of these settings