Class SurveySessionGenerator
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.plugins.survey.generators.SurveySessionGenerator
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
SurveySessionsGenerator
Generates a specific survey user session from its ID.
-
Field Summary
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
The ametys object resolver.protected SurveyAnswerDao
The survey data DAO.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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
generate()
protected Map<String,
SurveyAnswer> getAnswerMap
(SurveySession surveySession) Get the answers of a survey session as a Map, indexed by question ID.getValueMap
(SurveyQuestion question, String value) Get the user-input value as a Map from the database value, which is a single serialized string.protected void
saxAnswers
(SurveySession surveySession, Survey survey) Generate the answers of a given session.protected void
saxSession
(SurveySession surveySession, Survey survey, boolean withAnswers) Generate the data of a survey user session.void
service
(ServiceManager serviceManager) 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 Details
-
_resolver
The ametys object resolver. -
_surveyDao
The survey data DAO.
-
-
Constructor Details
-
SurveySessionGenerator
public SurveySessionGenerator()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
-
saxSession
protected void saxSession(SurveySession surveySession, Survey survey, boolean withAnswers) throws SAXException Generate the data of a survey user session.- Parameters:
surveySession
- the survey session.survey
- the survey.withAnswers
- true to generate answers along, false otherwise.- Throws:
SAXException
- if an error occurs while saxing the session
-
saxAnswers
Generate the answers of a given session.- Parameters:
surveySession
- the survey session.survey
- the survey.- Throws:
SAXException
- if an error occurs while saxing the answers
-
getAnswerMap
Get the answers of a survey session as a Map, indexed by question ID.- Parameters:
surveySession
- the survey session.- Returns:
- the answers as a Map, indexed by question ID.
-
getValueMap
Get the user-input value as a Map from the database value, which is a single serialized string.- Parameters:
question
- the question.value
- the value from the database.- Returns:
- the value as a Map.
-