public class SurveySessionGenerator extends ServiceableGenerator
Modifier and Type | Field and Description |
---|---|
protected AmetysObjectResolver |
_resolver
The ametys object resolver.
|
protected SurveyAnswerDao |
_surveyDao
The survey data DAO.
|
manager
objectModel, parameters, resolver, source
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
Constructor and Description |
---|
SurveySessionGenerator() |
Modifier and Type | Method and Description |
---|---|
void |
generate() |
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 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) |
dispose
recycle, setup
setConsumer, setContentHandler, setLexicalHandler
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setConsumer
protected AmetysObjectResolver _resolver
protected SurveyAnswerDao _surveyDao
public SurveySessionGenerator()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
service
in class ServiceableGenerator
ServiceException
public void generate() throws IOException, SAXException, ProcessingException
protected void saxSession(SurveySession surveySession, Survey survey, boolean withAnswers) throws SAXException
surveySession
- the survey session.survey
- the survey.withAnswers
- true to generate answers along, false otherwise.SAXException
- if an error occurs while saxing the sessionprotected void saxAnswers(SurveySession surveySession, Survey survey) throws SAXException
surveySession
- the survey session.survey
- the survey.SAXException
- if an error occurs while saxing the answersprotected Map<String,SurveyAnswer> getAnswerMap(SurveySession surveySession)
surveySession
- the survey session.protected Map<String,Set<String>> getValueMap(SurveyQuestion question, String value)
question
- the question.value
- the value from the database.