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
FieldsModifier and TypeFieldDescriptionprotected AmetysObjectResolverThe ametys object resolver.protected SurveyAnswerDaoThe survey data DAO.Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
managerFields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, sourceFields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate()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 voidsaxAnswers(SurveySession surveySession, Survey survey) Generate the answers of a given session.protected voidsaxSession(SurveySession surveySession, Survey survey, boolean withAnswers) Generate the data of a survey user session.voidservice(ServiceManager serviceManager) Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
disposeMethods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setupMethods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandlerMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
servicein interfaceServiceable- Overrides:
servicein 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.
-