Package org.encuestame.utils.web

Examples of org.encuestame.utils.web.TweetPollResultsBean


    /**
     * Test {@link TweetPollResultsBean}.
     */
    @Test
    public void testTweetPollResultsBean(){
        final TweetPollResultsBean tpResultsBean = new TweetPollResultsBean();
        tpResultsBean.setAnswerId(1L);
        tpResultsBean.setAnswerName("Yes");
        tpResultsBean.setColor("#000000");
        tpResultsBean.setPercent("50");
        tpResultsBean.setVotes(60L);

        assertNotNull(tpResultsBean.getAnswerId());
        assertNotNull(tpResultsBean.getAnswerName());
        assertNotNull(tpResultsBean.getColor());
        assertNotNull(tpResultsBean.getPercent());
        assertNotNull(tpResultsBean.getVotes());
    }
View Full Code Here


      * @param name
      * @param vote
      * @return
      */
     public TweetPollResultsBean createTweetPollResultsBean(final Long anwerId, final String name, final Long vote){
         final TweetPollResultsBean tpResultsBean = new TweetPollResultsBean();
         tpResultsBean.setAnswerId(anwerId);
         tpResultsBean.setAnswerName(name);
         tpResultsBean.setColor("#FFFF");
         tpResultsBean.setPercent("50");
         tpResultsBean.setVotes(vote);
         return tpResultsBean;
     }
View Full Code Here

             final List<TweetPollAnswerSwitchBean> listSwitchs = new ArrayList<TweetPollAnswerSwitchBean>();
             if (results) {
                 final List<TweetPollResultsBean> list = new ArrayList<TweetPollResultsBean>();
                 for (TweetPollSwitch tweetPollSwitch : answers) {
                     final TweetPollAnswerSwitchBean answerResults = ConvertDomainBean.convertTweetPollSwitchToBean(tweetPollSwitch, httpServletRequest);
                     final TweetPollResultsBean rBean = this.getVotesByTweetPollAnswerId(tweetPoll.getTweetPollId(), tweetPollSwitch.getAnswers());
                     answerResults.setResultsBean(rBean);
                     list.add(rBean);
                     listSwitchs.add(answerResults);
                }
                 this.calculatePercents(list);
View Full Code Here

             final List<TweetPollAnswerSwitchBean> listSwitchs = new ArrayList<TweetPollAnswerSwitchBean>();
             if (results) {
                 final List<TweetPollResultsBean> list = new ArrayList<TweetPollResultsBean>();
                 for (TweetPollSwitch tweetPollSwitch : answers) {
                     final TweetPollAnswerSwitchBean answerResults = ConvertDomainBean.convertTweetPollSwitchToBean(tweetPollSwitch, httpServletRequest);
                     final TweetPollResultsBean rBean = this.getVotesByTweetPollAnswerId(tweetPoll.getTweetPollId(), tweetPollSwitch.getAnswers());
                     answerResults.setResultsBean(rBean);
                     list.add(rBean);
                     listSwitchs.add(answerResults);
                }
                 this.calculatePercents(list);
View Full Code Here

    public TweetPollResultsBean getVotesByTweetPollAnswerId(
            final Long tweetPollId,
            final QuestionAnswer answer) {
        final List<Object[]> result = getTweetPollDao().getResultsByTweetPoll(tweetPollId, answer.getQuestionAnswerId());
        //log.debug("result getVotesByTweetPollAnswerId- "+result.size());
        final TweetPollResultsBean tweetPollResult = new TweetPollResultsBean();
        tweetPollResult.setAnswerName(answer.getAnswer());
        //FIXME: the next block must be in ConvertDomainBean
        if (result.size() == 0) {
            tweetPollResult.setAnswerId(answer.getQuestionAnswerId());
            tweetPollResult.setColor(answer.getColor());
            tweetPollResult.setVotes(0L);
        } else {
            for (Object[] objects : result) {
                tweetPollResult.setAnswerId(answer.getQuestionAnswerId());
                tweetPollResult.setColor(answer.getColor());
                //FIXME: where is the short url ??
                tweetPollResult.setShortUrl(answer.getUrlAnswer());
                tweetPollResult.setUrl(answer.getUrlAnswer());
                tweetPollResult.setVotes(Long.valueOf(objects[2].toString()));
            }
        }
        return tweetPollResult;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.utils.web.TweetPollResultsBean

Copyright © 2018 www.massapicom. 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.