Examples of PollBeanResult


Examples of org.encuestame.utils.web.PollBeanResult

    /**
     * Test {@link PollBeanResult}.
     */
    @Test
    public void testUnitPollResult(){
        final PollBeanResult pollResult =  new PollBeanResult();
        pollResult.setAnswerBean(new QuestionAnswerBean());
        pollResult.setResult(1L);
        pollResult.setVotedDate(new Date());
        assertNotNull(pollResult.getAnswerBean());
        assertNotNull(pollResult.getResult());
        assertNotNull(pollResult.getVotedDate());
    }
View Full Code Here

Examples of org.encuestame.utils.web.PollBeanResult

         final List<QuestionAnswer> answerList = getQuestionDao().getAnswersByQuestionId(poll.getQuestion().getQid());
         for (QuestionAnswer questionAnswer : answerList) {
             final List<Object[]> myPoll = getPollDao().retrieveResultPollsbyAnswer(poll.getPollId(), questionAnswer.getQuestionAnswerId());
             log.debug(" Resultpolls by answer  --->  " + myPoll.size() + "\n");
             if (myPoll.size() == 0) {
                 final PollBeanResult result = ConvertDomainBean.convertPollResultToBean(questionAnswer.getQuestionAnswerId(),
                                                questionAnswer.getAnswer(), questionAnswer.getColor(), 0L, poll.getQuestion());
                results.add(result);
             } else {
                 for (Object[] objects2 : myPoll) {
                     final Long answerId = objects2[0] == null ? null : Long.valueOf(objects2[0].toString());
                     final String answerString = objects2[1] == null ? null : objects2[1].toString();
                     final String color = objects2[2] == null ? null : objects2[2].toString();
                     final Long votes = objects2[3] == null ? null : Long.valueOf(objects2[3].toString());
                     if (answerId != null) {
                         final PollBeanResult result = ConvertDomainBean.convertPollResultToBean(answerId, answerString, color, votes, poll.getQuestion());
                         results.add(result);
                     } else {
                         throw new IllegalArgumentException("answer id is empty");
                     }
                 }
View Full Code Here

Examples of org.encuestame.utils.web.PollBeanResult

     * @return
     */
    public static PollBeanResult convertPollResultToBean(final Long answerId,
            final String answerString, final String color,
            final Long resultVotes, final Question question) {
        final PollBeanResult result = new PollBeanResult();
        final QuestionAnswerBean answer = new QuestionAnswerBean();
        answer.setAnswerId(answerId);
        answer.setAnswers(answerString);
        answer.setColor(color);
        answer.setQuestionId(question.getQid());
        result.setAnswerBean(answer);
        result.setResult(resultVotes);
        //FIXME: these properties are repeated, we need to update and unify these properties.
        result.setAnswerName(answer.getAnswers());
        result.setVotes(resultVotes);
        result.setColor(answer.getColor());
        result.setUrl(answer.getUrl());
        result.setShortUrl(answer.getShortUrl());
        result.setAnswerId(answerId);
        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.