public RatingPollingQuestion saveQuestion(RatingPollingQuestion pollingQuestion) throws Exception { if (voteDao.isRepeatedQuestion(pollingQuestion)) throw new RepeatedQuestionException("question_is_repeated"); else if (voteDao.isAnsweredQuestion(pollingQuestion)) throw new UsedQuestionException("edit_used_question_message"); else return (RatingPollingQuestion) voteDao.save(pollingQuestion); }
public MultipleChoicePollingQuestion saveQuestion(MultipleChoicePollingQuestion pollingQuestion) throws Exception { if (isRepeatedMultipleChoiceQuestion(pollingQuestion)) throw new RepeatedQuestionException("question_is_repeated"); else if (voteDao.isAnsweredQuestion(pollingQuestion)) throw new UsedQuestionException("edit_used_question_message"); else { return (MultipleChoicePollingQuestion) voteDao.save(pollingQuestion); } }
public boolean isEditableQuestion(AbstractPollingQuestion pollingQuestion) { return !voteDao.isAnsweredQuestion(pollingQuestion); }