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
public class SurveySessionGenerator extends ServiceableGenerator
Generates a specific survey user session from its ID. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver_resolverThe ametys object resolver.protected SurveyAnswerDao_surveyDaoThe 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
Constructors Constructor Description SurveySessionGenerator() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgenerate()protected Map<String,SurveyAnswer>getAnswerMap(SurveySession surveySession)Get the answers of a survey session as a Map, indexed by question ID.protected Map<String,Set<String>>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
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
- 
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver. 
- 
_surveyDao
protected SurveyAnswerDao _surveyDao
The survey data DAO. 
 - 
 
- 
Constructor Detail
- 
SurveySessionGenerator
public SurveySessionGenerator()
 
 - 
 
- 
Method Detail
- 
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
 servicein interfaceServiceable- Overrides:
 servicein classServiceableGenerator- Throws:
 ServiceException
 
- 
generate
public void generate() throws IOException, SAXException, ProcessingException
 
- 
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
protected void saxAnswers(SurveySession surveySession, Survey survey) throws SAXException
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
protected Map<String,SurveyAnswer> getAnswerMap(SurveySession surveySession)
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
protected Map<String,Set<String>> getValueMap(SurveyQuestion question, String value)
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.
 
 
 - 
 
 -