public class NewsletterUserPreferencesStorage extends AbstractLogEnabled implements UserPreferencesStorage, Component, Serviceable
| Modifier and Type | Field and Description | 
|---|---|
protected CategoryProviderExtensionPoint | 
_categoryEP
The category provider extension point. 
 | 
protected UserManager | 
_foUserManager
The front-office users manager. 
 | 
protected SubscribersDAO | 
_subscribersDao
The subscribers DAO. 
 | 
| Constructor and Description | 
|---|
NewsletterUserPreferencesStorage()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected Map<String,String> | 
getExistingCategoryIds(String email,
                      String siteName)
Get the existing subscriptions for a user in a given site. 
 | 
protected Subscriber | 
getSubscription(String siteName,
               User user,
               String categoryId)
Create a subscriber object from the given input. 
 | 
protected Subscriber | 
getSubscription(String siteName,
               User user,
               String categoryId,
               boolean generateDateAndToken)
Create a subscriber object from the given input. 
 | 
Map<String,String> | 
getUnTypedUserPrefs(UserIdentity userIdentity,
                   String storageContext,
                   Map<String,String> contextVars)
Get a user's preference values (as String) for a given context. 
 | 
Boolean | 
getUserPreferenceAsBoolean(UserIdentity userIdentity,
                          String storageContext,
                          Map<String,String> contextVars,
                          String id)
Get a single boolean user preference value for a given context. 
 | 
Date | 
getUserPreferenceAsDate(UserIdentity userIdentity,
                       String storageContext,
                       Map<String,String> contextVars,
                       String id)
Get a single date user preference value for a given context. 
 | 
Double | 
getUserPreferenceAsDouble(UserIdentity userIdentity,
                         String storageContext,
                         Map<String,String> contextVars,
                         String id)
Get a single double user preference value for a given context. 
 | 
Long | 
getUserPreferenceAsLong(UserIdentity userIdentity,
                       String storageContext,
                       Map<String,String> contextVars,
                       String id)
Get a single long user preference value for a given context. 
 | 
String | 
getUserPreferenceAsString(UserIdentity userIdentity,
                         String storageContext,
                         Map<String,String> contextVars,
                         String id)
Get a single string user preference value for a given context. 
 | 
void | 
removeUserPreferences(UserIdentity userIdentity,
                     String storageContext,
                     Map<String,String> contextVars)
Remove the stored user preferences for a login in a given context. 
 | 
void | 
service(ServiceManager serviceManager)  | 
void | 
setUserPreferences(UserIdentity userIdentity,
                  String storageContext,
                  Map<String,String> contextVars,
                  Map<String,String> preferences)
Set a user's preferences for a given context. 
 | 
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprotected UserManager _foUserManager
protected CategoryProviderExtensionPoint _categoryEP
protected SubscribersDAO _subscribersDao
public NewsletterUserPreferencesStorage()
public void service(ServiceManager serviceManager) throws ServiceException
service in interface ServiceableServiceExceptionpublic Map<String,String> getUnTypedUserPrefs(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars) throws UserPreferencesException
UserPreferencesStoragegetUnTypedUserPrefs in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementsUserPreferencesException - if an error occurs getting the preferences.public void setUserPreferences(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars, Map<String,String> preferences) throws UserPreferencesException
UserPreferencesStoragesetUserPreferences in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementspreferences - a Map of the preference values indexed by ID.UserPreferencesException - if an error occurredpublic void removeUserPreferences(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars) throws UserPreferencesException
UserPreferencesStorageremoveUserPreferences in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - the context variables.UserPreferencesException - if an error occurredpublic String getUserPreferenceAsString(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
UserPreferencesStoragegetUserPreferenceAsString in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementsid - the preference ID.UserPreferencesException - if an error occurredpublic Long getUserPreferenceAsLong(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
UserPreferencesStoragegetUserPreferenceAsLong in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementsid - the preference ID.UserPreferencesException - if an error occurredpublic Date getUserPreferenceAsDate(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
UserPreferencesStoragegetUserPreferenceAsDate in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementsid - the preference ID.UserPreferencesException - if an error occurredpublic Boolean getUserPreferenceAsBoolean(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
UserPreferencesStoragegetUserPreferenceAsBoolean in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementsid - the preference ID.UserPreferencesException - if an error occurredpublic Double getUserPreferenceAsDouble(UserIdentity userIdentity, String storageContext, Map<String,String> contextVars, String id) throws UserPreferencesException
UserPreferencesStoragegetUserPreferenceAsDouble in interface UserPreferencesStorageuserIdentity - the user.storageContext - the preferences storage context.contextVars - The context variables including environment elementsid - the preference ID.UserPreferencesException - if an error occurredprotected Subscriber getSubscription(String siteName, User user, String categoryId)
siteName - the site name.user - the user.categoryId - the category ID.protected Subscriber getSubscription(String siteName, User user, String categoryId, boolean generateDateAndToken)
siteName - the site name.user - the user.categoryId - the category ID.generateDateAndToken - true to generate a token and set the subscription date, false otherwise.