Interface SettingService


public interface SettingService
Stores and removes a value associated with a key.
eXo level API
Experimental
  • Method Details

    • set

      void set(Context context, Scope scope, String key, SettingValue<?> value)
      Sets a value with the key that is composed by context, scope, key. The value will be saved in the database.
      Parameters:
      context - The context with which the specified value is associated.
      scope - The scope with which the specified value is associated.
      key - The key with which the specified value is associated.
      value - The value associated with the specified key.
      eXo level API
      Experimental
    • remove

      void remove(Context context, Scope scope, String key)
      Removes a value associated with a specified composite key.
      Parameters:
      context - The context with which the specified value is associated.
      scope - The scope with which the specified value is associated.
      key - The key with which the specified value is associated.
      eXo level API
      Experimental
    • remove

      void remove(Context context, Scope scope)
      Removes all values associated with a specified context and scope from the database.
      Parameters:
      context - The context with which the specified value is associated. The context type must be USER and context, and Id must not be "null".
      scope - The scope with which the specified value is associated. The scope.id must not be "null".
      eXo level API
      Experimental
    • remove

      void remove(Context context)
      Removes all values associated with a specified context from the database.
      Parameters:
      context - The context with which the specified value is associated. The context type must be USER and context, and Id must not be "null".
      eXo level API
      Experimental
    • get

      SettingValue<?> get(Context context, Scope scope, String key)
      Gets values associated with a specified composite key (context, scope, key) in the database.
      Parameters:
      context - The context with which the specified value is associated. The context type must be USER and context and Id must not be "null".
      scope - The scope with which the specified value is associated. The scope.id must not be "null".
      key - The key with which the specified value is associated.
      eXo level API
      Experimental
    • countContextsByType

      default long countContextsByType(String contextType)
      Returns the total count of contexts by type
      Parameters:
      contextType - context type name ('USER' OR 'GLOBAL')
      Returns:
      count of contexts by type
    • getContextNamesByType

      default List<String> getContextNamesByType(String contextType, int offset, int limit)
      Returns context names by type
      Parameters:
      contextType - context type name ('USER' OR 'GLOBAL')
      offset - query offset
      limit - query max results
      Returns:
      the list of context names
    • getSettingsByContext

      Map<Scope,Map<String,SettingValue<String>>> getSettingsByContext(Context context)
      Get settings related to a scope and a context
      Parameters:
      context - Context used to search settings
      Returns:
      Map of settings with key = setting name and as value = corresponding SettingValue
    • getContextsByTypeAndScopeAndSettingName

      List<Context> getContextsByTypeAndScopeAndSettingName(String contextType, String scopeType, String scopeName, String settingName, int offset, int limit)
      Gets a list of names of contexts of a chosen type that have a setting associated to a dedicated scope
      Parameters:
      contextType - type of context used in filter
      scopeType - type of scope used in filter
      scopeName - name of scope used in filter
      settingName - name of setting used in filter
      offset - search query offset
      limit - search query limit
      Returns:
      a List of String for filtered context names
    • getEmptyContextsByTypeAndScopeAndSettingName

      Set<String> getEmptyContextsByTypeAndScopeAndSettingName(String contextType, String scopeType, String scopeName, String settingName, int offset, int limit)
      Gets a list of names of contexts of a chosen type that doesn't have settings associated to a dedicated scope
      Parameters:
      contextType - type of context used in filter
      scopeType - type of scope used in filter
      scopeName - name of scope used in filter
      settingName -
      offset - search query offset
      limit - search query limit
      Returns:
      a Set of String for filtered context names
    • save

      void save(Context context)
      Saves a Context on database
      Parameters:
      context - context to save
    • getSettingsByContextAndScope

      Map<String,SettingValue> getSettingsByContextAndScope(String contextType, String contextName, String scopeType, String scopeName)
      Get a list of settings that belongs to the context and scope
      Parameters:
      contextType - type of ontext
      contextName - name of ontext
      scopeType - type of scope
      scopeName - name of scope
      Returns:
      Map of settings key and value