Example usage for org.apache.commons.collections ListUtils EMPTY_LIST

List of usage examples for org.apache.commons.collections ListUtils EMPTY_LIST

Introduction

In this page you can find the example usage for org.apache.commons.collections ListUtils EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for org.apache.commons.collections ListUtils EMPTY_LIST.

Click Source Link

Document

An empty unmodifiable list.

Usage

From source file:org.encuestame.rest.api.v1.survey.PollJsonController.java

/**
 * @api {get} /api/survey/poll/search.json Search polls.
 * @apiName GetSearch/*from  w w  w .j  a v a  2 s  .  co  m*/
 * @apiGroup Poll
 * @apiDescription Return all comments that will be filtered by type.
 * @apiParam {String} typeSearch - XXXX
 * @apiParam {String} [keyword] Keyword to search related polls.
 * @apiParam {Number} [max] Defines the maximum number of search results.
 * @apiParam {Number} [pollFolderId]  Folder id to organize and store the poll.
 * @apiParam {Number} [start] Defines the starting number of the page of results.
 * @apiParam {String[} [social_networks] Filter tweetpolls by networks accounts.
 * @apiParam {Number[ } [social_account_networks] Filter polls by social networks accounts.
 * @apiParam {Boolean} [_published]  Filter by published polls
 * @apiParam {Boolean} [_complete]  Filter by completed polls.
 * @apiParam {Boolean} [_favourite] Filter by favourites tweetpolls.
 * @apiParam {Boolean} [_scheduled] Filter by polls scheduled.
 * @apiParam {Boolean} [_isHidden] Filter by hidden polls.
 * @apiParam {Boolean} [_isPassprotected] - Filter by tweetpolls with pass protected
 * @apiParam {String} [period] Date range to search results.
 * @apiVersion 1.0.0
 * @apiSampleRequest http://www.encuestame.org/demo/api/survey/poll/search.json?typeSearch=all&keyword=What&max=1&start=0
 * @apiPermission ENCUESTAME_USER
 * @apiSuccessExample
 * {
  "error": { },
  "success": {
      "poll": [
          {
              "hashtags": [
                  {
                      "id": 11,
                      "size": 15,
                      "hashTagName": "internet",
                      "hits": 1
                  }
              ],
              "is_password_restriction": false,
              "owner_username": "demo10",
              "relative_time": null,
              "total_votes": 36,
              "hits": 21,
              "item_type": "poll",
              "like_votes": 0,
              "dislike_votes": 0,
              "create_date": null,
              "relevance": 11,
              "favorite": false,
              "latitude": 0,
              "longitude": 0,
              "additional_info": "",
              "show_comments": "MODERATE",
              "is_show_results": true,
              "folder_id": null,
              "is_show_additional_info": false,
              "is_close_after_date": false,
              "close_date": null,
              "is_close_after_quota": false,
              "close_quota": null,
              "is_ip_restricted": null,
              "ip_restricted": "",
              "multiple_response": null,
              "total_comments": 0,
              "id": 25,
              "completed_poll": false,
              "creation_date": "2012-08-18",
              "question": {
                  "question_name": "Which Spice Girl did David Beckham marry?",
                  "slug": "which-spice-girl-did-david-beckham-marry%3F",
                  "hits": null,
                  "version": null,
                  "state_id": null,
                  "id": 101,
                  "uid": 10,
                  "pattern": "SINGLE_SELECTION",
                  "widget": "encuestame.org.core.commons.questions.patterns.SingleOptionResponse",
                  "list_answers": [ ]
              },
              "finish_date": null,
              "published": true,
              "close_notification": true,
              "show_resultsPoll": true,
              "updated_date": null,
              "url": null,
              "short_url": null,
              "hastags_string": "internet,computer,business"
          }
      ]
  }
        
  }
 */
@PreAuthorize("hasRole('ENCUESTAME_USER')")
@RequestMapping(value = "/api/survey/poll/search.json", method = RequestMethod.GET)
public @ResponseBody ModelMap searchPolls(
        @RequestParam(value = "typeSearch", required = true) String typeSearch,
        @RequestParam(value = "keyword", required = false) String keyword,
        @RequestParam(value = "max", required = false) Integer max,
        @RequestParam(value = "pollFolderId", required = false) Long pollFolderId,
        @RequestParam(value = "start", required = false) Integer start,
        @RequestParam(value = "social_networks", required = false) List<String> socialNetworks,
        @RequestParam(value = "social_account_networks", required = false) List<Long> socialAccountNetworks,
        @RequestParam(value = "_published", required = false) Boolean isPublished,
        @RequestParam(value = "_complete", required = false) Boolean isCompleted,
        @RequestParam(value = "_favourite", required = false) Boolean isFavourite,
        @RequestParam(value = "_scheduled", required = false) Boolean isScheduled,
        @RequestParam(value = "_isHidden", required = false) Boolean isHidden,
        @RequestParam(value = "_isPassprotected", required = false) Boolean isPassprotected,
        @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(EnumerationUtils.getEnumFromString(TypeSearch.class, typeSearch));
        tpollSearchBean.setProviders(socialNetworks == null ? ListUtils.EMPTY_LIST
                : ConvertDomainBean.convertSocialProviderStringToProvider(socialNetworks));
        tpollSearchBean.setSocialAccounts(
                socialAccountNetworks == null ? ListUtils.EMPTY_LIST : socialAccountNetworks);
        tpollSearchBean.setIsHidden(isHidden == null ? false : isHidden);
        tpollSearchBean.setIsPasswordProtected(isPassprotected == null ? false : isPassprotected);
        final List<SearchBean> list = (List<SearchBean>) getPollService()
                .filterSearchPollsByType(tpollSearchBean);
        //log.debug("/api/survey/poll/search.json---------------->  "+ list.size());
        jsonResponse.put("poll", list);
        setItemResponse(jsonResponse);
    } catch (EnMeException e) {
        log.error(e);
        setError(e.getMessage(), response);
    }
    return returnData();
}

From source file:org.encuestame.rest.api.v1.survey.TweetPollJsonController.java

/**
 * @api {get} /api/survey/tweetpoll/search.json Get TweetPolls
 * @apiName GetTweetpolls/*from   ww w.  j a v  a  2 s . com*/
 * @apiGroup Tweetpoll
 * @apiDescription Returns a collection of relevant TweetPolls matching a specified query.
 * @apiParam {String} typeSearch - XXXX
 * @apiParam {String} [keyword] Keyword to search related Tweetpolls.
 * @apiParam {Number} max Defines the maximum number of search results.
 * @apiParam {Number} start Defines the starting number of the page of results.
 * @apiParam {String[]} [social_networks] Filter tweetpolls by social networks accounts.
 * @apiParam {Number[] } [social_account_networks] Filter tweetpolls by social networks accounts.
 * @apiParam {Boolean} [_published] Filter by published tweetpolls.
 * @apiParam {Boolean} [_complete] Filter by completed tweetpolls.
 * @apiParam {Boolean} [_favourite] Filter by favourite.
 * @apiParam {Boolean} [_scheduled] Filter by tweetpolls scheduled
 * @apiParam {String} [period] Date range to search results.
 * @apiVersion 1.0.0
 * @apiSampleRequest http://www.encuestame.org/demo/api/survey/tweetpoll/search.json
 * @apiPermission ENCUESTAME_USER
 */

@PreAuthorize("hasRole('ENCUESTAME_USER')")
@RequestMapping(value = "/api/survey/tweetpoll/search.json", method = RequestMethod.GET)
public @ResponseBody ModelMap getListTweetPoll(
        @RequestParam(value = "typeSearch", required = true) String typeSearch,
        @RequestParam(value = "keyword", required = false) String keyword,
        @RequestParam(value = "max", required = true) Integer max,
        @RequestParam(value = "start", required = true) Integer start,
        @RequestParam(value = "social_networks", required = false) List<String> socialNetworks,
        @RequestParam(value = "social_account_networks", required = false) List<Long> socialAccountNetworks,
        @RequestParam(value = "_published", required = false) Boolean isPublished,
        @RequestParam(value = "_complete", required = false) Boolean isCompleted,
        @RequestParam(value = "_favourite", required = false) Boolean isFavourite,
        @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 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(EnumerationUtils.getEnumFromString(TypeSearch.class, 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>) getTweetPollService()
                .filterTweetPollByItemsByTypeSearch(tpollSearchBean, request);
        log.debug("/api/survey/tweetpoll/search.json---------------->  " + list.size());
        jsonResponse.put("tweetPolls", list);
        setItemResponse(jsonResponse);
    } catch (EnMeException e) {
        log.error(e);
        setError(e.getMessage(), response);
    }
    return returnData();
}

From source file:org.encuestame.test.business.csv.cron.TestCron.java

/**
 *
 *///from  w w w. ja va  2 s.  c o  m
@Test
public void testProcessItemstoCalculateRelevance() {
    createFakesTweetPoll(getSpringSecurityLoggedUserAccount());
    final List<TweetPoll> tweetPolls = this.tweetPollService.getTweetPollsbyRange(10, 0, null);
    this.frontEndService.processItemstoCalculateRelevance(tweetPolls, ListUtils.EMPTY_LIST,
            ListUtils.EMPTY_LIST, SearchPeriods.ALLTIME);
}

From source file:org.encuestame.test.business.service.TestTweetPollService.java

@Test
@Category(DefaultTest.class)
public void testGetTweetsPollsByUserName() throws EnMeNoResultsFoundException {
    final Question question1 = createQuestion("Why the sea is salad?", "html");
    final Question question2 = createQuestion("Why the sea is big?", "html");
    createTweetPollPublicated(true, true, new Date(), this.userAccount, question1);
    createTweetPollPublicated(true, true, new Date(), this.userAccount, question2);
    final UserAccount secUser = createUserAccount("diana", this.user);
    final TweetPollSearchBean tpSearchBean = createTweetpollSearchBean(Boolean.FALSE, Boolean.FALSE,
            Boolean.FALSE, Boolean.FALSE, "xxx", "7", 10, 0, TypeSearch.BYOWNER);
    List<SocialProvider> enums = new ArrayList<SocialProvider>();
    enums.add(SocialProvider.FACEBOOK);/*from w  ww.j  a v  a  2 s  .c o  m*/
    enums.add(SocialProvider.TWITTER);
    tpSearchBean.setProviders(ListUtils.EMPTY_LIST);
    tpSearchBean.setSocialAccounts(ListUtils.EMPTY_LIST);
    final List<TweetPollBean> tweetPollsByUser = getTweetPollService()
            .getTweetsPollsByUserName(getUsernameLogged(), null, tpSearchBean);

    // assertEquals("Should be equals", 2 , tweetPollsByUser.size());
}

From source file:org.kuali.kfs.module.ar.document.FinalBilledIndicatorTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    document.getInvoiceGeneralDetail().setFinalBillIndicator(true);
    documentService.saveDocument(document);
    document.setInvoiceSuspensionCategories(ListUtils.EMPTY_LIST);
    SpringContext.getBean(ContractsGrantsInvoiceDocumentService.class).updateLastBilledDate(document);
}

From source file:org.lockss.plugin.dspace.TestOaiPmhCrawlSeed.java

public void testBadPermissionUrlListThrows() throws ConfigurationException, PluginException, IOException {

    mau.setPermissionUrls(null);//from   w w w . j  a v a  2s . com
    try {
        cs.getPermissionUrls();
        fail("null permission url list should have thrown");
    } catch (InvalidDefinition e) {
        assertMatchesRE("non-null permission URL list", e.getMessage());
    }

    mau.setPermissionUrls(ListUtils.EMPTY_LIST);
    try {
        cs.getPermissionUrls();
        fail("empty permission url list should have thrown");
    } catch (InvalidDefinition e) {
        assertMatchesRE("non-null permission URL list", e.getMessage());
    }
}

From source file:org.lockss.plugin.dspace.TestOaiPmhCrawlSeed.java

public void testEmptyIdentifiers() throws ParseException, ConfigurationException, PluginException, IOException {
    msp = (MockServiceProvider) cs.getServiceProvider();
    msp.setIdentifiers(buildHeaderList(ListUtils.EMPTY_LIST));
    assertEquals(ListUtils.EMPTY_LIST, cs.getStartUrls());
}

From source file:org.lockss.plugin.highwire.TestHighWirePressH20CrawlSeedFactory.java

public void testBadPermissionUrlListThrows() throws ConfigurationException, PluginException, IOException {

    mau.setStartUrls(null);// ww  w  .  ja va  2 s  .c  o  m
    mau.setPermissionUrls(null);
    try {
        cs.getPermissionUrls();
        fail("null permission url list should have thrown");
    } catch (InvalidDefinition e) {
        assertMatchesRE("non-null permission URL list", e.getMessage());
    }

    mau.setPermissionUrls(ListUtils.EMPTY_LIST);
    try {
        cs.getPermissionUrls();
        fail("empty permission url list should have thrown");
    } catch (InvalidDefinition e) {
        assertMatchesRE("non-null permission URL list", e.getMessage());
    }
}

From source file:org.ncic.bioinfo.sparkseq.algorithms.walker.mutect.Mutect.java

public Mutect(GenomeLocParser genomeLocParser, RefContentProvider refContentProvider,
        SamContentProvider tumorContentProvider, SamContentProvider normalContentProvider,
        List<RODContentProvider> rodContentProviderList, List<GenomeLoc> intervals) {
    super(genomeLocParser, refContentProvider, tumorContentProvider, rodContentProviderList, intervals);
    if (normalContentProvider != null) {
        hasNormalBam = true;/*  w  ww .  ja v  a2  s . c  om*/
        normalSamTraverser = getNormalLocusSamTraverser(normalContentProvider, intervals);
    } else {
        normalSamTraverser = getNormalLocusSamTraverser(
                new SamContentProvider(ListUtils.EMPTY_LIST, tumorContentProvider.getSamFileHeader()),
                intervals);
    }

    initialize();
}

From source file:org.openhab.core.items.GroupItem.java

/** 
 * The accepted data types of a group item is the same as of the underlying base item.
 * If none is defined, the intersection of all sets of accepted data types of all group
 * members is used instead.//from  w ww .j  a v a 2s.co m
 * 
 * @return the accepted data types of this group item
 */
@SuppressWarnings("unchecked")
public List<Class<? extends State>> getAcceptedDataTypes() {
    if (baseItem != null) {
        return baseItem.getAcceptedDataTypes();
    } else {
        List<Class<? extends State>> acceptedDataTypes = null;

        for (Item item : members) {
            if (acceptedDataTypes == null) {
                acceptedDataTypes = item.getAcceptedDataTypes();
            } else {
                acceptedDataTypes = ListUtils.intersection(acceptedDataTypes, item.getAcceptedDataTypes());
            }
        }
        return acceptedDataTypes == null ? ListUtils.EMPTY_LIST : acceptedDataTypes;
    }
}