Package org.ametys.plugins.core.userpref
Class UserPreferencesGenerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.xml.AbstractXMLProducer
-
- org.apache.cocoon.generation.AbstractGenerator
-
- org.apache.cocoon.generation.ServiceableGenerator
-
- org.ametys.core.util.cocoon.AbstractCurrentUserProviderServiceableGenerator
-
- org.ametys.plugins.core.userpref.UserPreferencesGenerator
-
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
FOUserPreferencesGenerator
public class UserPreferencesGenerator extends AbstractCurrentUserProviderServiceableGenerator
Generates user preferences.
-
-
Field Summary
Fields Modifier and Type Field Description protected UserPreferencesExtensionPoint
_userPrefEP
The user preferences extension point.protected UserPreferencesManager
_userPrefManager
The user preferences manager.-
Fields inherited from class org.ametys.core.util.cocoon.AbstractCurrentUserProviderServiceableGenerator
_currentUserProvider
-
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
-
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
-
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
-
Constructor Summary
Constructors Constructor Description UserPreferencesGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_saxPreference(UserPreference preference, Object value, Map<String,String> contextVars)
Generate a preference definition and value.protected void
_saxPreferences(String storageContext, Map<String,String> contextVars, UserIdentity user, boolean excludePrivate)
Generate the list of user preferences for a given user and context.void
generate()
protected Map<String,String>
getContextVars(Request request)
Get the preferences context.protected UserIdentity
getUser()
Get the user in the user manager.void
service(ServiceManager serviceManager)
-
Methods inherited from class org.ametys.core.util.cocoon.AbstractCurrentUserProviderServiceableGenerator
_getCurrentUser
-
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
-
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
-
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
-
-
-
Field Detail
-
_userPrefEP
protected UserPreferencesExtensionPoint _userPrefEP
The user preferences extension point.
-
_userPrefManager
protected UserPreferencesManager _userPrefManager
The user preferences manager.
-
-
Constructor Detail
-
UserPreferencesGenerator
public UserPreferencesGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractCurrentUserProviderServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
getUser
protected UserIdentity getUser()
Get the user in the user manager.- Returns:
- the user .
-
getContextVars
protected Map<String,String> getContextVars(Request request)
Get the preferences context.- Parameters:
request
- the request.- Returns:
- the preferences context as a Map.
-
_saxPreferences
protected void _saxPreferences(String storageContext, Map<String,String> contextVars, UserIdentity user, boolean excludePrivate) throws ProcessingException, SAXException, UserPreferencesException
Generate the list of user preferences for a given user and context.- Parameters:
storageContext
- the preferences context.contextVars
- The context varsuser
- the user.excludePrivate
- true to exclude private user preferences- Throws:
ProcessingException
- if an error occurredSAXException
- if an error occurredUserPreferencesException
- if an error occurred
-
_saxPreference
protected void _saxPreference(UserPreference preference, Object value, Map<String,String> contextVars) throws SAXException, ProcessingException
Generate a preference definition and value.- Parameters:
preference
- The parameter to SAXvalue
- The parameter value. Can be null.contextVars
- The context vars- Throws:
SAXException
- If an error occurred while SAXingProcessingException
- If an error occurred
-
-