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
FieldsModifier and TypeFieldDescriptionprotected CategoryProviderExtensionPointThe category provider extension point.protected static final I18nizableTextThe newsletter pref group.protected static final StringThe newsletter preferences storage component role.protected ModelItemTypeExtensionPointThe user preference types extension pointFields inherited from interface org.ametys.core.userpref.UserPreferenceProvider
CONTEXT_VAR_WORKSPACE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.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 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. -
_userPreferenceTypeExtensionPoint
The user preference types extension point
-
-
Constructor Details
-
NewsletterUserPreferenceProvider
public NewsletterUserPreferenceProvider()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getPreferences
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
Get a booleanUserPreferencerepresenting a category.- Parameters:
category- the category.index- the category index in the extension point.- Returns:
- a boolean
UserPreferencerepresenting the category.
-