Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The preferences should be stored separately in a special store.

Storing preferences

The preferences should be represented as key-value pairs.
The preference key value could be a complex name which could represent the hierarchy where each item in hierarchy is separated by '.' character. For instance, logviewer.defaultFilter and logviewer.filters would represent the preferences "defaultFilter" and "filters" for a logviewer widget.
The value could be a serialized json string to represent the complex preference settings or to be a primitive value like int, long, double, String

Accessing preferences with REST API

...

Code Block
javascript
javascript
{
    "f391718": {
        timezone: "Europe/London",
        language: "en",
        background: "#cccccc",
        saveTabs: true,
        updateInterval: 5,
        "logviewer.defaultFilter": {...},
        "logviewer.filters": { "warning": {...}, "alerts": {...}, ... },
        ...
      },
    ...
    "anotherUser": {
    ...
    }
}

Storing preferences

The preferences should be represented as key-value pairs.
The preference key value could be a complex name which could represent the hierarchy where each item in hierarchy is separated by '.' character. For instance, logviewer.defaultFilter and logviewer.filters would represent the preferences "defaultFilter" and "filters" for a logviewer widget.
The value could be a serialized json string to represent the complex preference settings or to be a primitive value like int, long, double, String

Preferences model

The preference model is depicted below

With this model the PreferencesProvider belongs to AuthenticationProvider and instantiated by the AuthenticationProvider.
User configured object has the getPreferences()/setPreferences() methods which delegates the call to PreferencesProvider (user.getAuthenticationProvider().getPreferencesProvider().getPreferences(user))

Saving tabs configuration if saveTabs preference is turned on

The tabs configuration needs to be serialized as json and stored in openTabs preference
We need to identify what exactly information we need to save for the opened tab. It looks like we need to consider storing at lest of the following:

...