createPollBean.setMultiple(Boolean.FALSE);
createPollBean.setCloseDate(null);
createPollBean.setLimitVote(null);
createPollBean.setAllowAdd(Boolean.FALSE);
createPollBean.setHashtags(arrayHashtag);
final Poll poll = getPollService().createPoll(createPollBean);
getTweetPollDao().saveOrUpdate(poll);
double hits = getRandomNumberRange(EnMePlaceHolderConfigurer
.getIntegerProperty("demo.min.poll.hits"), EnMePlaceHolderConfigurer
.getIntegerProperty("demo.max.poll.hits"));
for (int i = 0; i < hits; i++) {
getFrontEndService().registerHit(null, poll, null, null, EnMeUtils.ipGenerator(), HitCategory.VISIT);
}
double votes = getRandomNumberRange(EnMePlaceHolderConfigurer
.getIntegerProperty("demo.min.poll.votes"), EnMePlaceHolderConfigurer
.getIntegerProperty("demo.max.poll.votes"));
for (int i = 0; i < votes; i++) {
getFrontEndService().registerVote(poll.getPollId(), TypeSearchResult.POLL, EnMeUtils.ipGenerator());
}
log.trace(" Polls ID ..."+poll.getPollId());
final List<QuestionAnswerBean> answer = getPollService().retrieveAnswerByQuestionId(poll.getQuestion().getQid());
for (QuestionAnswerBean questionAnswerBean : answer) {
double totalVotes = getRandomNumberRange(0, EnMePlaceHolderConfigurer.getIntegerProperty("demo.votes.by.poll")) - 1;
log.trace(totalVotes+":: Votes for this POLL switch id "+questionAnswerBean.getAnswers());
for (int i = 0; i < totalVotes; i++) {
getPollService().vote(poll,
poll.getQuestion().getSlugQuestion(),
EnMeUtils.ipGenerator(),questionAnswerBean.getAnswerId());
}
}
log.trace(" Polls ID ..."+poll.getCreateDate());
} catch (EnMeExpcetion e) {
e.printStackTrace();
}
}
//retrive all hits