Class BaseUserPreferencesServiceImpl
- java.lang.Object
-
- fr.paris.lutece.portal.service.prefs.BaseUserPreferencesServiceImpl
-
- All Implemented Interfaces:
IUserPreferencesService,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
PortalUserPreferenceServiceImpl
public class BaseUserPreferencesServiceImpl extends Object implements IUserPreferencesService, org.springframework.beans.factory.InitializingBean
Abstract User Preferences Service- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidclear(String strUserId)Clear all preferences for a given uservoidclearKey(String strUserId, String strKey)Clear a preference for a given uservoidclearKeyPrefix(String strUserId, String strPrefix)Clear all preferences with a given prefix for a given userbooleanexistsKey(String strUserId, String strKey)Cheks if a preference key existsbooleanexistsValueForKey(String strKey, String strValue)Checks if a value is already used for a preference given keyStringget(String strUserId, String strKey, String strDefault)Get a preference for a given userbooleangetBoolean(String strUserId, String strKey, boolean bDefault)Get a boolean preference for a given userintgetInt(String strUserId, String strKey, int nDefault)Get an integer preference for a given userList<String>getUsers(String strKey, String strValue)Get the list of users associated with a key and a valueList<String>keys(String strUserId)Get all preference keys for a given uservoidput(String strUserId, String strKey, String strValue)Put a preference for a given uservoidputBoolean(String strUserId, String strKey, boolean bValue)Put a boolean preference for a given uservoidputInt(String strUserId, String strKey, int nValue)Put an integer preference for a given uservoidsetDao(IPreferencesDAO dao)Sets the DAO
-
-
-
Method Detail
-
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:
getin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- The preference's keystrDefault- 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:
getIntin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- The preference's keynDefault- 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:
getBooleanin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- The preference's keybDefault- 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:
putin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- The preference's keystrValue- The value
-
putInt
public void putInt(String strUserId, String strKey, int nValue)
Put an integer preference for a given user- Specified by:
putIntin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- The preference's keynValue- The value
-
putBoolean
public void putBoolean(String strUserId, String strKey, boolean bValue)
Put a boolean preference for a given user- Specified by:
putBooleanin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- The preference's keybValue- The value
-
keys
public List<String> keys(String strUserId)
Get all preference keys for a given user- Specified by:
keysin interfaceIUserPreferencesService- Parameters:
strUserId- The user's ID- Returns:
- The keys
-
clear
public void clear(String strUserId)
Clear all preferences for a given user- Specified by:
clearin interfaceIUserPreferencesService- Parameters:
strUserId- The user's ID
-
clearKey
public void clearKey(String strUserId, String strKey)
Clear a preference for a given user- Specified by:
clearKeyin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrKey- 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:
clearKeyPrefixin interfaceIUserPreferencesService- Parameters:
strUserId- The user's IDstrPrefix- The keys prefix
-
existsKey
public boolean existsKey(String strUserId, String strKey)
Cheks if a preference key exists- Specified by:
existsKeyin interfaceIUserPreferencesService- Parameters:
strUserId- The User IDstrKey- 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:
getUsersin interfaceIUserPreferencesService- Parameters:
strKey- The preference's keystrValue- 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.
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
existsValueForKey
public boolean existsValueForKey(String strKey, String strValue)
Description copied from interface:IUserPreferencesServiceChecks if a value is already used for a preference given key- Specified by:
existsValueForKeyin interfaceIUserPreferencesService- Parameters:
strKey- The Pref keystrValue- The Pref Value- Returns:
- 1 if exists otherwise false
-
-