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
Modifier and TypeFieldDescriptionprotected CategoryProviderExtensionPoint
The category provider extension point.protected static final I18nizableText
The newsletter pref group.protected static final String
The newsletter preferences storage component role.Fields inherited from interface org.ametys.core.userpref.UserPreferenceProvider
CONTEXT_VAR_WORKSPACE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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.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 Details
-
_NEWSLETTER_PREF_GROUP
The newsletter pref group. -
_NEWSLETTER_PREF_STORAGE_COMPONENT
The newsletter preferences storage component role.- See Also:
-
_categoryEP
The category provider extension point.
-
-
Constructor Details
-
NewsletterUserPreferenceProvider
public NewsletterUserPreferenceProvider()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getPreferences
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
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.
-