}
@Override
public String saveResponse() {
try {
CurrentVotingInfoBean currentVotingInfoBean = this.getCurrentVotingInfoBean();
int currentIndexInt = this.getCurrentQuestionIndex().intValue();
if (currentIndexInt != currentVotingInfoBean.getCurrentQuestionIndex()) {
//Check REFRESH
return SUCCESS;
}
Question question = this.getCurrentQuestion();
for (int i=0; i<this.getChoiceIds().size(); i++) {
Integer choiceId = this.getChoiceIds().get(i);
SingleQuestionResponse singleResponse = new SingleQuestionResponse();
singleResponse.setChoiceId(choiceId);
singleResponse.setQuestionId(question.getId());
Choice choice = question.getChoice(choiceId);
if (choice.isFreeText()) {
singleResponse.setFreeText(this.getInsertedFreeText().trim());
}
currentVotingInfoBean.getVoterResponse().getResponses().add(singleResponse);
}
currentVotingInfoBean.setNextIndex();
} catch (Throwable t) {
ApsSystemUtils.logThrowable(t, this, "saveResponse", "Error saving response");
return FAILURE;
}
return SUCCESS;