Package org.ametys.plugins.core.userpref
Class GetUserPreferencesAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.core.userpref.GetUserPreferencesAction
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
Get user preferences as a JSON object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UserPreferencesExtensionPoint
The user preferences extension point.protected UserPreferencesManager
The user preferences manager.Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionact
(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) getContextVars
(Request request) Get the preferences context.protected UserIdentity
getUser
(Parameters parameters) Get the user in the user manager.userPrefs2JsonObject
(Map<String, String> contextVars, boolean excludePrivate) Convert user preferences to JSON objectMethods inherited from class org.apache.cocoon.acting.ServiceableAction
service
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_userPrefEP
The user preferences extension point. -
_userPrefManager
The user preferences manager.
-
-
Constructor Details
-
GetUserPreferencesAction
public GetUserPreferencesAction()
-
-
Method Details
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
userPrefs2JsonObject
protected Map<String,Object> userPrefs2JsonObject(Map<String, String> contextVars, boolean excludePrivate) throws ProcessingException, UserPreferencesExceptionConvert user preferences to JSON object- Parameters:
contextVars
- The context varsexcludePrivate
- true to exclude private preferences- Returns:
- The JSON object representing the user preferences
- Throws:
ProcessingException
- if an error occurredUserPreferencesException
- if an error occurred
-
getUser
Get the user in the user manager.- Parameters:
parameters
- The parameters- Returns:
- the user .
-
getContextVars
Get the preferences context.- Parameters:
request
- the request.- Returns:
- the preferences context as a Map.
-