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
_categoryEP
The category provider extension point.protected static I18nizableText
_NEWSLETTER_PREF_GROUP
The newsletter pref group.protected static String
_NEWSLETTER_PREF_STORAGE_COMPONENT
The 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 void
fillUserPreferences(Set<UserPreference> prefs, List<Category> categories, CategoryProvider categoryProvider, MutableInt index)
Create aUserPreference
per newsletter category, recursively.protected UserPreference
getCategoryUserPref(Category category, int index)
Get a booleanUserPreference
representing a category.Collection<UserPreference>
getPreferences(Map<String,String> contextVars)
Get this provider's preferences.void
service(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:
service
in interfaceServiceable
- Throws:
ServiceException
-
getPreferences
public Collection<UserPreference> getPreferences(Map<String,String> contextVars)
Description copied from interface:UserPreferenceProvider
Get this provider's preferences.- Specified by:
getPreferences
in 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 aUserPreference
per 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 booleanUserPreference
representing a category.- Parameters:
category
- the category.index
- the category index in the extension point.- Returns:
- a boolean
UserPreference
representing the category.
-
-