Package org.exoplatform.agenda.model
Class AgendaUserSettings
java.lang.Object
org.exoplatform.agenda.model.AgendaUserSettings
- All Implemented Interfaces:
Cloneable
-
Constructor Summary
ConstructorsConstructorDescriptionAgendaUserSettings(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 — whatclone()copies. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOrUpdateConnectedConnector(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.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.static AgendaUserSettingsfromString(String value) 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 onlyconnectedRemoteProviderandconnectedRemoteUserId, and its one account materialises here as a one-entry list the first time the list is read.voidremoveConnectedConnector(String providerName) Removes the account held on the given provider, leaving the other connected accounts untouched.toString()Serialises this object to the JSON blob persisted in the settings store.
-
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 — whatclone()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 channelagendaDefaultView- view type the agenda opens onagendaWeekStartOn- day the displayed weeks start onshowWorkingTime- whether the working-time frame is highlightedworkingTimeStart- start hour of the working-time frameworkingTimeEnd- end hour of the working-time frameconnectedRemoteProvider- legacy mirror of the first connected account's provider nameconnectedRemoteUserId- legacy mirror of the first connected account's remote user idautomaticPushEvents- whether eXo events are pushed to the connected account without askingtimeZoneId- identifier of the user's time zoneworkedDaysNumber- number of days the working week countsshowRemoteEventsForTimeLine- whether the timeline widget shows remote events
-
-
Method Details
-
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 onlyconnectedRemoteProviderandconnectedRemoteUserId, 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
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 onremoteUserId- identifier of the user on the remote provider
-
removeConnectedConnector
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
Serialises this object to the JSON blob persisted in the settings store. -
fromString
-
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.
-