model.put("domain_config", domain);
response.setContentType("text/javascript; charset=UTF-8");
if (TypeSearchResult.TWEETPOLL.equals(typeItem)) {
// generate tweetpoll body
// generate tweetpoll body
final TweetPoll tweetPoll = getTweetPollService().getTweetPollById(pollId);
model.put("tp", tweetPoll);
model.put("editorOwner", tweetPoll.getEditorOwner());
model.put("votes", tweetPoll.getLikeVote());
model.put("hits", tweetPoll.getHits());
model.put("date_published", EnMeUtils.formatDate(tweetPoll.getCreateDate(), "HH:mm - d MMMM yyyy"));
model.put("owner_picture", domain + "/picture/profile/" + tweetPoll.getEditorOwner().getUsername() + "/thumbnail");
model.put("owner_profile_url", domain + "/profile/" + tweetPoll.getEditorOwner().getUsername());
StringBuffer buffer = new StringBuffer();
String q = tweetPoll.getQuestion().getQuestion();
final List<TweetPollSwitch> answers = getTweetPollService().getTweetPollSwitch(tweetPoll);
final Set<HashTag> hashTags = tweetPoll.getHashTags();
buffer.append(EnMeUtils.generateBodyTweetPollasHtml(domain, tweetPoll, q,answers, hashTags));
model.put("body_text", buffer.toString());
model.put("url_tpoll", domain +
"/tweetpoll/" + tweetPoll.getTweetPollId() + "/" + tweetPoll.getQuestion().getSlugQuestion());
text = VelocityEngineUtils.mergeTemplateIntoString(
velocityEngine, HTML_TEMPLATES + "/tweetpoll_form.vm", "utf-8", model);
} else if (TypeSearchResult.TWEETPOLLRESULT.equals(typeItem)) {
final TweetPoll tpoll = getTweetPollService().getTweetPollById(pollId);
final TweetPollDetailBean tpollDetail = getTweetPollService().getTweetPollDetailInfo(pollId);
model.put("owner_picture", domain + "/picture/profile/" + tpoll.getEditorOwner().getUsername() + "/thumbnail");
model.put("editorOwner", tpoll.getEditorOwner());
model.put("question", tpoll.getQuestion());
model.put("url", EnMeUtils.createTweetPollUrlAccess(domain, tpoll));
model.put("answersList", tpollDetail.getResults());
model.put("date_published", EnMeUtils.formatDate(tpoll.getCreateDate(), "HH:mm - d MMMM yyyy"));
text = VelocityEngineUtils.mergeTemplateIntoString(
velocityEngine, HTML_TEMPLATES + "/tweetpoll_votes.vm", "utf-8", model);
embebedBody.setAditionalInfo(tpollDetail.getResults());
} else if (TypeSearchResult.POLL.equals(typeItem)) {
// generate poll body