Package org.encuestame.utils.web.search

Examples of org.encuestame.utils.web.search.PollSearchBean


            @RequestParam(value = "_scheduled", required = false) Boolean isScheduled,
            @RequestParam(value = "period", required = false) String period,
            HttpServletRequest request, HttpServletResponse response)
            throws JsonGenerationException, JsonMappingException, IOException {
        final Map<String, Object> jsonResponse = new HashMap<String, Object>();
        final PollSearchBean tpollSearchBean = new PollSearchBean();
        try {
            // 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);
            final List<SearchBean> list = (List<SearchBean>) getPollService().filterSearchPollsByType(
                    tpollSearchBean, request);
            //log.debug("/api/survey/poll/search.json---------------->  "+ list.size());
            jsonResponse.put("poll", list);
            setItemResponse(jsonResponse);
View Full Code Here


   * Test for PollService.filterSearchPollsByType()
   * @throws EnMeExpcetion
   */
  @Test
    public void testfilterSearchPollsByType() throws EnMeExpcetion{
    final PollSearchBean bean = new PollSearchBean();
    //all
    bean.setTypeSearch(TypeSearch.ALL);
        List<SearchBean> pollAll = this.pollService.filterSearchPollsByType(bean, this.request);
        assertEquals(pollAll.size(), 1);
        //by onwer
        bean.setTypeSearch(TypeSearch.BYOWNER);
        List<SearchBean> pollAll2 = this.pollService.filterSearchPollsByType(bean, this.request);
       assertEquals(pollAll2.size(), 1);
       //last day
       bean.setTypeSearch(TypeSearch.LASTDAY);
       List<SearchBean> pollAll3 = this.pollService.filterSearchPollsByType(bean, this.request);
       assertEquals(pollAll3.size(), 0);
       //last week
       bean.setTypeSearch(TypeSearch.LASTWEEK);
       List<SearchBean> pollAll4 = this.pollService.filterSearchPollsByType(bean, this.request);
       assertEquals(pollAll4.size(), 1);      
       //last 30 days
       bean.setTypeSearch(TypeSearch.FAVOURITES);
       List<SearchBean> pollAll5 = this.pollService.filterSearchPollsByType(bean, this.request);
       assertEquals(pollAll5.size(), 1);           
   
View Full Code Here

TOP

Related Classes of org.encuestame.utils.web.search.PollSearchBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.