Class NewsletterUserPreferenceProvider
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.newsletter.userpref.NewsletterUserPreferenceProvider
-
- All Implemented Interfaces:
UserPreferenceProvider,LogEnabled,Serviceable
public class NewsletterUserPreferenceProvider extends AbstractLogEnabled implements UserPreferenceProvider, Serviceable
Provides all newsletter categories as boolean user preferences. Used to build a general subscription service, with one checkbox by category.
-
-
Field Summary
Fields Modifier and Type Field Description protected CategoryProviderExtensionPoint_categoryEPThe category provider extension point.protected static I18nizableText_NEWSLETTER_PREF_GROUPThe newsletter pref group.protected static String_NEWSLETTER_PREF_STORAGE_COMPONENTThe newsletter preferences storage component role.-
Fields inherited from interface org.ametys.core.userpref.UserPreferenceProvider
CONTEXT_VAR_WORKSPACE
-
-
Constructor Summary
Constructors Constructor Description NewsletterUserPreferenceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfillUserPreferences(Set<UserPreference> prefs, List<Category> categories, CategoryProvider categoryProvider, MutableInt index)Create aUserPreferenceper newsletter category, recursively.protected UserPreferencegetCategoryUserPref(Category category, int index)Get a booleanUserPreferencerepresenting a category.Collection<UserPreference>getPreferences(Map<String,String> contextVars)Get this provider's preferences.voidservice(ServiceManager serviceManager)-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_NEWSLETTER_PREF_GROUP
protected static final I18nizableText _NEWSLETTER_PREF_GROUP
The newsletter pref group.
-
_NEWSLETTER_PREF_STORAGE_COMPONENT
protected static final String _NEWSLETTER_PREF_STORAGE_COMPONENT
The newsletter preferences storage component role.- See Also:
- Constant Field Values
-
_categoryEP
protected CategoryProviderExtensionPoint _categoryEP
The category provider extension point.
-
-
Constructor Detail
-
NewsletterUserPreferenceProvider
public NewsletterUserPreferenceProvider()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getPreferences
public Collection<UserPreference> getPreferences(Map<String,String> contextVars)
Description copied from interface:UserPreferenceProviderGet this provider's preferences.- Specified by:
getPreferencesin interfaceUserPreferenceProvider- Parameters:
contextVars- a Map of context variables.- Returns:
- a Collection of preferences for the context.
-
fillUserPreferences
protected void fillUserPreferences(Set<UserPreference> prefs, List<Category> categories, CategoryProvider categoryProvider, MutableInt index)
Create aUserPreferenceper newsletter category, recursively.- Parameters:
prefs- the user preferences Set to fill.categories- the categories to work on.categoryProvider- the category provider.index- the current user preference index, to increase while processing categories.
-
getCategoryUserPref
protected UserPreference getCategoryUserPref(Category category, int index)
Get a booleanUserPreferencerepresenting a category.- Parameters:
category- the category.index- the category index in the extension point.- Returns:
- a boolean
UserPreferencerepresenting the category.
-
-