Interface PreferencesService

All Known Implementing Classes:
PreferencesServiceImpl

public interface PreferencesService
A PreferencesService is responsible to manage Preferences. Whereby Preferences have particular defined scopes, e.g. some are defined in global scope which means they are visible and valid for the whole application. Others are only valid in a certain restricted scope, probably only visible for a particular Module, Role or User.
Author:
Heiko Scherrer
See Also:
  • Method Details

    • findAll

      @NotNull @NotNull Collection<PreferenceEO> findAll()
      Find and return all Preferences.
      Returns:
      A Collection of Preferences, never null
    • findByPKey

      @NotNull @NotNull PreferenceEO findByPKey(@NotBlank @NotBlank String pKey)
      Find and return the Preferences identified by the pKey.
      Parameters:
      pKey - The persistent identifier
      Returns:
      The instance, never null
      Throws:
      org.ameba.exception.NotFoundException - If the instance does not exist
    • findForOwnerAndScope

      @NotNull @NotNull Collection<PreferenceEO> findForOwnerAndScope(String owner, @NotNull @NotNull PropertyScope scope)
      Find and return all Preferences of a specific scope that belong to the given owner.
      Parameters:
      owner - The owner of the Preference
      scope - What kind of Preference it is
      Returns:
      A Collection of Preferences, never null
    • findForOwnerAndScopeAndKey

      Optional<PreferenceEO> findForOwnerAndScopeAndKey(String owner, @NotNull @NotNull PropertyScope scope, @NotBlank @NotBlank String key)
      Find and return the Preference of a specific scope that belongs to the given owner and has the given key.
      Parameters:
      owner - The owner of the Preference
      scope - What kind of Preference it is
      key - The Preference key
      Returns:
      A Collection of Preferences, never null
    • findForScopeOwnerGroupName

      List<PreferenceEO> findForScopeOwnerGroupName(String owner, @NotNull @NotNull PropertyScope scope, @NotBlank @NotBlank String groupName)
      Find and return all Preferences that belong to a group with the same groupName.
      Parameters:
      owner - The owner of the Preference
      scope - What kind of Preference it is
      groupName - The name of the group
      Returns:
      All instances, never null
    • existsForOwnerAndScopeAndKey

      boolean existsForOwnerAndScopeAndKey(String owner, @NotNull @NotNull PropertyScope scope, @NotBlank @NotBlank String key)
      Checks whether a Preference of a specific scope that belongs to the given owner and has the given key exists.
      Parameters:
      owner - The owner of the Preference
      scope - What kind of Preference it is
      key - The Preference key
      Returns:
      true if it does exist, otherwise false
    • create

      @NotNull @NotNull PreferenceEO create(@NotNull @NotNull PreferenceEO preference)
      Create a new non-existing Preference.
      Parameters:
      preference - The instance to create
      Returns:
      The created instance
      Throws:
      org.ameba.exception.ResourceExistsException - in case the passed Preference already exists
    • update

      @NotNull @NotNull PreferenceEO update(@NotBlank @NotBlank String pKey, @NotNull @NotNull PreferenceEO preference)
      Update the given and existing Preference.
      Parameters:
      pKey - The persistent identifier of the Preference to save
      preference - The Preference instance to save
      Returns:
      Saved instance
      Throws:
      org.ameba.exception.NotFoundException - In case the Preferences does not exist
    • delete

      void delete(@NotBlank @NotBlank String pKey)
      Delete an existing Preference.
      Parameters:
      pKey - The persistent identifier of the Preference to delete.
    • reloadInitialPreferences

      void reloadInitialPreferences()
      Load Preferences from file and merge them with the ones in the persistent store.