@RequestParam(value = "period", required = false) String period,
@PathVariable final String type,
HttpServletRequest request, HttpServletResponse response)
throws JsonGenerationException, JsonMappingException, IOException {
final Map<String, Object> jsonResponse = new HashMap<String, Object>();
final TweetPollSearchBean tpollSearchBean = new TweetPollSearchBean();
try {
log.debug("search.json" + typeSearch);
log.debug("search.json" + keyword);
log.debug("search.json" + max);
log.debug("search.json" + start);
log.debug("search.json socialNetworks" + socialNetworks);
log.debug("search.json socialAccountNetworks " + socialAccountNetworks);
log.debug("search.json isCompleted " + isPublished);
log.debug("search.json" + isCompleted);
log.debug("search.json favourite" + isFavourite);
// Create TweetpollSearchBean
tpollSearchBean.setIsComplete(isCompleted == null ? false : isCompleted);
tpollSearchBean.setIsFavourite(isFavourite == null ? false : isFavourite);
tpollSearchBean.setIsPublished(isPublished == null ? false : isPublished);
tpollSearchBean.setIsScheduled(isScheduled == null ? false : isScheduled);
tpollSearchBean.setKeyword(keyword == null ? null : keyword.isEmpty() ? null : keyword);
tpollSearchBean.setMax(max);
//tpollSearchBean.setPeriod(period); it's not used, will be removed in the future.
tpollSearchBean.setSearchResult(null);
tpollSearchBean.setStart(start);
tpollSearchBean.setTypeSearch(TypeSearch.getSearchString(typeSearch));
tpollSearchBean.setProviders(socialNetworks == null ? ListUtils.EMPTY_LIST : ConvertDomainBean.convertSocialProviderStringToProvider(socialNetworks));
tpollSearchBean.setSocialAccounts(socialAccountNetworks == null ? ListUtils.EMPTY_LIST : socialAccountNetworks);
//socialNetworks.size() == 0 ? null : ConvertDomainBean.convertSocialProviderStringToProvider(socialNetworks));
final TypeSearchResult typeResult = TypeSearchResult.getTypeSearchResult(type);
if (typeResult.equals(TypeSearchResult.TWEETPOLL)) {
final List<SearchBean> list = (List<SearchBean>) getTweetPollService().filterTweetPollByItemsByTypeSearch(
tpollSearchBean, request);