Package sk.iway.iwcm.components.welcome
Class DashboardSettingsService
java.lang.Object
sk.iway.iwcm.components.welcome.DashboardSettingsService
Validates and persists shared dashboard layouts and domain-specific options, preserving shortcuts during widget resets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReads the shared layout with only the requested domain's options.reset(int userId) Clears widget preferences, all domain options and the news acknowledgement while retaining shortcuts.reset(int userId, String domainKey, DashboardSettingsDto layout) Replaces widget preferences atomically while preserving shortcuts read under the account lock.save(int userId, String domainKey, DashboardSettingsDto settings) Validates and replaces the shared layout and current-domain options in one transaction.
-
Constructor Details
-
DashboardSettingsService
-
-
Method Details
-
load
Reads the shared layout with only the requested domain's options.- Parameters:
userId- ID of the account that owns the settingsdomainKey- decimal root group ID identifying the active domain- Returns:
- stored settings, or an unconfigured DTO when the stored layout is absent or invalid
- Throws:
IllegalStateException- if the settings cannot be read from the database
-
save
Validates and replaces the shared layout and current-domain options in one transaction.- Parameters:
userId- ID of the account that owns the settingsdomainKey- decimal root group ID identifying the active domainsettings- settings to validate and persist; missing widget options are initialized in place- Returns:
- the supplied settings with the layout and shortcuts marked as configured
- Throws:
IllegalArgumentException- if the settings are invalidIllegalStateException- if the settings cannot be persisted
-
reset
Clears widget preferences, all domain options and the news acknowledgement while retaining shortcuts. Shortcut configuration and migration flags are preserved; the layout is marked as unconfigured so the client can supply default widgets.- Parameters:
userId- ID of the account whose widget preferences are reset- Returns:
- retained shortcuts and configuration flags after the reset
- Throws:
IllegalStateException- if the reset cannot be persisted
-
reset
Replaces widget preferences atomically while preserving shortcuts read under the account lock. Existing domain options and the news acknowledgement are cleared. A supplied layout provides replacement widgets and current-domain options; its shortcuts are included only when the account's shortcuts have not been configured. The legacy bookmark migration flag is preserved.- Parameters:
userId- ID of the account whose widget preferences are resetdomainKey- decimal root group ID identifying the active domainlayout- replacement layout, ornullto leave widgets unconfigured for client defaults- Returns:
- persisted settings containing retained shortcuts and any supplied replacement widgets
- Throws:
IllegalArgumentException- if the supplied or combined layout is invalidIllegalStateException- if the reset cannot be persisted
-