Class BaseUserPreferencesServiceImpl

java.lang.Object
fr.paris.lutece.portal.service.prefs.BaseUserPreferencesServiceImpl
All Implemented Interfaces:
IUserPreferencesService
Direct Known Subclasses:
PortalUserPreferenceServiceImpl

@ApplicationScoped public class BaseUserPreferencesServiceImpl extends Object implements IUserPreferencesService
Abstract User Preferences Service
Since:
4.0
  • Method Details

    • setDao

      public void setDao(IPreferencesDAO dao)
      Sets the DAO
      Parameters:
      dao - The DAO
    • get

      public String get(String strUserId, String strKey, String strDefault)
      Get a preference for a given user
      Specified by:
      get in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
      strDefault - The default value
      Returns:
      The preference's value
    • getInt

      public int getInt(String strUserId, String strKey, int nDefault)
      Get an integer preference for a given user
      Specified by:
      getInt in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
      nDefault - The default value
      Returns:
      The preference's value
    • getBoolean

      public boolean getBoolean(String strUserId, String strKey, boolean bDefault)
      Get a boolean preference for a given user
      Specified by:
      getBoolean in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
      bDefault - The default value
      Returns:
      The preference's value
    • put

      public void put(String strUserId, String strKey, String strValue)
      Put a preference for a given user
      Specified by:
      put in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
      strValue - The value
    • putInt

      public void putInt(String strUserId, String strKey, int nValue)
      Put an integer preference for a given user
      Specified by:
      putInt in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
      nValue - The value
    • putBoolean

      public void putBoolean(String strUserId, String strKey, boolean bValue)
      Put a boolean preference for a given user
      Specified by:
      putBoolean in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
      bValue - The value
    • keys

      public List<String> keys(String strUserId)
      Get all preference keys for a given user
      Specified by:
      keys in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      Returns:
      The keys
    • clear

      public void clear(String strUserId)
      Clear all preferences for a given user
      Specified by:
      clear in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
    • clearKey

      public void clearKey(String strUserId, String strKey)
      Clear a preference for a given user
      Specified by:
      clearKey in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strKey - The preference's key
    • clearKeyPrefix

      public void clearKeyPrefix(String strUserId, String strPrefix)
      Clear all preferences with a given prefix for a given user
      Specified by:
      clearKeyPrefix in interface IUserPreferencesService
      Parameters:
      strUserId - The user's ID
      strPrefix - The keys prefix
    • existsKey

      public boolean existsKey(String strUserId, String strKey)
      Cheks if a preference key exists
      Specified by:
      existsKey in interface IUserPreferencesService
      Parameters:
      strUserId - The User ID
      strKey - The Pref key
      Returns:
      1 if exists otherwise false
    • getUsers

      public List<String> getUsers(String strKey, String strValue)
      Get the list of users associated with a key and a value
      Specified by:
      getUsers in interface IUserPreferencesService
      Parameters:
      strKey - The preference's key
      strValue - The preference's value
      Returns:
      The list of user id associated with a key and a value, or an empty list if no user id is associated with the given parameters.
    • existsValueForKey

      public boolean existsValueForKey(String strKey, String strValue)
      Description copied from interface: IUserPreferencesService
      Checks if a value is already used for a preference given key
      Specified by:
      existsValueForKey in interface IUserPreferencesService
      Parameters:
      strKey - The Pref key
      strValue - The Pref Value
      Returns:
      1 if exists otherwise false