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;
}