Class CalendarCategoriesHelper
- java.lang.Object
-
- org.ametys.plugins.calendar.helpers.CalendarCategoriesHelper
-
- All Implemented Interfaces:
Component
,Serviceable
public class CalendarCategoriesHelper extends Object implements Component, Serviceable
helper to manage calendar categories
-
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user providerprotected JSONUtils
_jsonUtils
Json utilsprotected UserPreferencesManager
_userPref
The user preferencesstatic String
ROLE
The component role.protected static String
USER_PREF_ID
user pref id where the categories should be storedprotected static String
ZONEITEMID
Parameter name for the zone item id
-
Constructor Summary
Constructors Constructor Description CalendarCategoriesHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getUserCategories(String siteName, String zoneItemId)
Get the user preferences for this calendarList<String>
getUserCategories(UserIdentity identity, String siteName, String zoneItemId)
Get the user preferences for this calendarList<String>
getUserCategories(Request request)
Get the user preferences for this calendarvoid
service(ServiceManager manager)
boolean
setUserCategories(String siteName, String zoneItemId, List<String> categories)
Set the user preferences for this calendarboolean
setUserCategories(UserIdentity identity, String siteName, String zoneItemId, List<String> categories)
Set the user preferences for this calendarboolean
setUserCategories(Request request)
Set the user preferences for this calendar
-
-
-
Field Detail
-
ZONEITEMID
protected static final String ZONEITEMID
Parameter name for the zone item id- See Also:
- Constant Field Values
-
USER_PREF_ID
protected static final String USER_PREF_ID
user pref id where the categories should be stored- See Also:
- Constant Field Values
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_userPref
protected UserPreferencesManager _userPref
The user preferences
-
_jsonUtils
protected JSONUtils _jsonUtils
Json utils
-
-
Constructor Detail
-
CalendarCategoriesHelper
public CalendarCategoriesHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setUserCategories
public boolean setUserCategories(Request request) throws UserPreferencesException
Set the user preferences for this calendar- Parameters:
request
- the request from the service- Returns:
- true if the preference was set
- Throws:
UserPreferencesException
- impossible to set the preference
-
setUserCategories
public boolean setUserCategories(String siteName, String zoneItemId, List<String> categories) throws UserPreferencesException
Set the user preferences for this calendar- Parameters:
siteName
- Site namezoneItemId
- Zone Item Id where the service is putcategories
- categories to set- Returns:
- true if the preference was set
- Throws:
UserPreferencesException
- impossible to set the preference
-
setUserCategories
public boolean setUserCategories(UserIdentity identity, String siteName, String zoneItemId, List<String> categories) throws UserPreferencesException
Set the user preferences for this calendar- Parameters:
identity
- UsersiteName
- Site namezoneItemId
- Zone Item Id where the service is putcategories
- categories to set- Returns:
- true if the preference was set
- Throws:
UserPreferencesException
- impossible to set the preference
-
getUserCategories
public List<String> getUserCategories(Request request) throws UserPreferencesException
Get the user preferences for this calendar- Parameters:
request
- the request from the service- Returns:
- a List of categories
- Throws:
UserPreferencesException
- impossible to get the preference
-
getUserCategories
public List<String> getUserCategories(String siteName, String zoneItemId) throws UserPreferencesException
Get the user preferences for this calendar- Parameters:
siteName
- Site namezoneItemId
- Zone Item Id where the service is put- Returns:
- a List of categories
- Throws:
UserPreferencesException
- impossible to get the preference
-
getUserCategories
public List<String> getUserCategories(UserIdentity identity, String siteName, String zoneItemId) throws UserPreferencesException
Get the user preferences for this calendar- Parameters:
identity
- UsersiteName
- Site namezoneItemId
- Zone Item Id where the service is put- Returns:
- a List of categories
- Throws:
UserPreferencesException
- impossible to set the preference
-
-