/** * @param question * @return */ public QuestionAnswer createAnswers(final Question question, final String answerText) { final QuestionAnswer answer = new QuestionAnswer(); answer.setQuestions(question); answer.setAnswer(answerText); answer.setColor(PictureUtils.getRandomHexColor()); this.getQuestionDao().saveOrUpdate(answer); log.debug("createAnswers =>" + answer.getQuestionAnswerId()); return answer; }
/** * Save Question Answer. * * @param answerBean answer * @throws EnMeExpcetion EnMeExpcetion */ public QuestionAnswer createQuestionAnswer( final QuestionAnswerBean answerBean, final Question question) { log.debug("action createQuestionAnswer " + answerBean.toString()); final QuestionAnswer answer = new QuestionAnswer(); answer.setQuestions(question); answer.setAnswer(answerBean.getAnswers()); answer.setProvider(answerBean.getShortUrlType()); answer.setColor(PictureUtils.getRandomHexColor()); answer.setUniqueAnserHash(answerBean.getAnswerHash()); this.getQuestionDao().saveOrUpdate(answer); answerBean.setAnswerId(answer.getQuestionAnswerId()); log.debug("QuestionAnswer created:{" + answerBean.toString()); return answer; }