final Options options = new Options();
log.debug("Autosave TweetPoll Id --> " + tweetPollId);
log.debug("Autosave Question --> " + question);
final Map<String, Object> jsonResponse = new HashMap<String, Object>();
if (tweetPollId == null && question != null && !question.isEmpty()) {
final TweetPollBean tweetPollBean = this.fillTweetPoll(
options, question, user, null);
//new tweetpoll domain.
final TweetPoll tp = createTweetPoll(tweetPollBean);
//retrieve answers stored.
final TweetPollBean tpB = ConvertDomainBean.convertTweetPollToBean(tp);
log.debug("Tweetpoll Created --->" + tpB.toString());
jsonResponse.put("tweetPoll", tpB);
} else if (tweetPollId != null && question != null) {
options.setCaptcha(captcha);
options.setFollowDashBoard(onDashboard);
options.setLimitVotes(limitVotes);
options.setLiveResults(liveResults);
options.setScheduled(isScheduled);
options.setScheduledDate(filterValue(scheduledDate));
options.setScheduledTime(scheduldedTime);
options.setMaxLimitVotes(votesToLimit);
options.setFollowDashBoard(onDashboard);
options.setRepeatedVotes(repeatedVotes);
options.setMaxRepeatedVotes(repeatedVotesNum);
options.setResumeLiveResults(resumeLiveResults);
//update tweetPoll
final TweetPollBean tweetPollBean = this.fillTweetPoll(options, question, user, tweetPollId);
ConvertDomainBean.convertTweetPollToBean(updateTweetPoll(tweetPollBean));
log.debug("Tweetpoll Updated --->" + tweetPollBean.toString());
jsonResponse.put("tweetPoll", tweetPollBean);
} else {
setError("create tweetpoll bad request", response);
}
setItemResponse(jsonResponse);