Package org.ametys.core.userpref
Interface UserPreferencesStorage
-
- All Known Subinterfaces:
DefaultUserPreferencesStorage
- All Known Implementing Classes:
EmptyUserPreferencesStorage
,JdbcPlainUserPreferencesStorage
,JdbcXmlUserPreferencesStorage
,NewsletterUserPreferencesStorage
,ODFCartUserPreferencesStorage
,UserManagerUserPreferenceStorage
public interface UserPreferencesStorage
Manager for handling user preferences.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Map<String,String>
getUnTypedUserPrefs(UserIdentity user, String storageContext, Map<String,String> contextVars)
Get a user's preference values (as String) for a given context.Boolean
getUserPreferenceAsBoolean(UserIdentity user, String storageContext, Map<String,String> contextVars, String id)
Get a single boolean user preference value for a given context.Date
getUserPreferenceAsDate(UserIdentity user, String storageContext, Map<String,String> contextVars, String id)
Get a single date user preference value for a given context.Double
getUserPreferenceAsDouble(UserIdentity user, String storageContext, Map<String,String> contextVars, String id)
Get a single double user preference value for a given context.Long
getUserPreferenceAsLong(UserIdentity user, String storageContext, Map<String,String> contextVars, String id)
Get a single long user preference value for a given context.String
getUserPreferenceAsString(UserIdentity user, String storageContext, Map<String,String> contextVars, String id)
Get a single string user preference value for a given context.void
removeUserPreferences(UserIdentity user, String storageContext, Map<String,String> contextVars)
Remove the stored user preferences for a login in a given context.void
setUserPreferences(UserIdentity user, String storageContext, Map<String,String> contextVars, Map<String,String> preferences)
Set a user's preferences for a given context.
-
-
-
Method Detail
-
getUnTypedUserPrefs
Map<String,String> getUnTypedUserPrefs(UserIdentity user, String storageContext, Map<String,String> contextVars) throws UserPreferencesException
Get a user's preference values (as String) for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elements- Returns:
- the user preference values as a Map of String indexed by preference ID.
- Throws:
UserPreferencesException
- if an error occurs getting the preferences.
-
removeUserPreferences
void removeUserPreferences(UserIdentity user, String storageContext, Map<String,String> contextVars) throws UserPreferencesException
Remove the stored user preferences for a login in a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- the context variables.- Throws:
UserPreferencesException
- if an error occurred
-
setUserPreferences
void setUserPreferences(UserIdentity user, String storageContext, Map<String,String> contextVars, Map<String,String> preferences) throws UserPreferencesException
Set a user's preferences for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elementspreferences
- a Map of the preference values indexed by ID.- Throws:
UserPreferencesException
- if an error occurred
-
getUserPreferenceAsString
String getUserPreferenceAsString(UserIdentity user, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
Get a single string user preference value for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elementsid
- the preference ID.- Returns:
- the user preference value as a String.
- Throws:
UserPreferencesException
- if an error occurred
-
getUserPreferenceAsLong
Long getUserPreferenceAsLong(UserIdentity user, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
Get a single long user preference value for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elementsid
- the preference ID.- Returns:
- the user preference value as a Long.
- Throws:
UserPreferencesException
- if an error occurred
-
getUserPreferenceAsDate
Date getUserPreferenceAsDate(UserIdentity user, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
Get a single date user preference value for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elementsid
- the preference ID.- Returns:
- the user preference value as a Date.
- Throws:
UserPreferencesException
- if an error occurred
-
getUserPreferenceAsBoolean
Boolean getUserPreferenceAsBoolean(UserIdentity user, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
Get a single boolean user preference value for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elementsid
- the preference ID.- Returns:
- the user preference value as a Boolean.
- Throws:
UserPreferencesException
- if an error occurred
-
getUserPreferenceAsDouble
Double getUserPreferenceAsDouble(UserIdentity user, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
Get a single double user preference value for a given context.- Parameters:
user
- the user.storageContext
- the preferences storage context.contextVars
- The context variables including environment elementsid
- the preference ID.- Returns:
- the user preference value as a Double.
- Throws:
UserPreferencesException
- if an error occurred
-
-