Package twitter4j

Examples of twitter4j.Paging


    public  void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {

       for (MeasurementScheduleRequest req : metrics) {
          if (req.getName().equals("tweetCount")) {
             Twitter twitter = tFactory.getInstance();
             Paging paging = new Paging();

             MeasurementDataNumeric res;
             if (isSearch) {
                Query q = new Query(keyword);
                q.setSinceId(lastId);
                if (lastId == NOT_YET_SET)
                  q.setRpp(1);
                else
                  q.setRpp(20);
                QueryResult qr = twitter.search(q);
                List<Tweet> tweets = qr.getTweets();
                res = new MeasurementDataNumeric(req, (double) tweets.size());

                eventPoller.addTweets(tweets);
                if (tweets.size()>0)
                   lastId = tweets.get(0).getId();
             }
             else {
                List<Status> statuses;
                if (lastId == NOT_YET_SET) {
                   paging.setCount(1);
                }
                else {
                   paging.setCount(100);
                }
                paging.setSinceId(lastId);
                statuses = twitter.getUserTimeline(keyword,paging);
                res = new MeasurementDataNumeric(req, (double) statuses.size());

                eventPoller.addStatuses(statuses);
                if (statuses.size()>0)
View Full Code Here


       for (MeasurementScheduleRequest req : metrics) {
          if (req.getName().equals("tweetCount")) {

//             Twitter twitter = new Twitter(username,password,serverUrl);
             Paging paging = new Paging();
             if (lastId == NOT_YET_SET) {
                paging.setSinceId(1);
                paging.setCount(1);
             }
             else {
                paging.setSinceId(lastId);
                paging.setCount(100);
             }
             List<Status> statuses;
             statuses = twitter.getHomeTimeline(paging);
             if (lastId>0) {
                MeasurementDataNumeric res;
View Full Code Here

        }
    }

    private List<Status> getGeoStatusList(Twitter twitter, String user) throws TwitterException {
     
      List<Status> statusList = twitter.getUserTimeline(user,new Paging(1, 10));
       
      List<Status> geoStatusList = new ArrayList<Status>();
     
        for (Status status : statusList) {
         
View Full Code Here

    public MentionsConsumer(TwitterEndpoint te) {
        super(te);
    }

    public List<Status> pollConsume() throws TwitterException {
        List<Status> list = te.getProperties().getTwitter().getMentions(new Paging(lastId));
        for (Status s : list) {
            checkLastId(s.getId());
        }
        return list;
    }
View Full Code Here

    public RetweetsConsumer(TwitterEndpoint te) {
        super(te);
    }

    public List<Status> pollConsume() throws TwitterException {
        List<Status> list = te.getProperties().getTwitter().getRetweetsOfMe(new Paging(lastId));
        for (Status s : list) {
            checkLastId(s.getId());
        }
        return list;
    }
View Full Code Here

    public UserConsumer(TwitterEndpoint te) {
        super(te);
    }

    public List<Status> pollConsume() throws TwitterException {
        List<Status> list = te.getProperties().getTwitter().getUserTimeline(te.getProperties().getUser(), new Paging(lastId));
        for (Status s : list) {
            checkLastId(s.getId());
        }
        return list;
    }
View Full Code Here

    public HomeConsumer(TwitterEndpoint te) {
        super(te);
    }

    public List<Status> pollConsume() throws TwitterException {
        List<Status> list = te.getProperties().getTwitter().getHomeTimeline(new Paging(lastId));
        for (Status s : list) {
            checkLastId(s.getId());
        }
        return list;
    }
View Full Code Here

    public DirectMessageConsumer(TwitterEndpoint te) {
        super(te);
    }

    public List<DirectMessage> pollConsume() throws TwitterException {
        List<DirectMessage> list = te.getProperties().getTwitter().getDirectMessages(new Paging(lastId));
        for (DirectMessage dm : list) {
            checkLastId(dm.getId());
        }
        return list;
    }
View Full Code Here

    public DirectMessageConsumer(TwitterEndpoint te) {
        this.te = te;
    }

    public List<DirectMessage> pollConsume() throws TwitterException {
        List<DirectMessage> list = te.getTwitter().getDirectMessages(new Paging(lastId));
        for (DirectMessage dm : list) {
            checkLastId(dm.getId());
        }
        return list;
    }
View Full Code Here

    public MentionsConsumer(TwitterEndpoint te) {
        this.te = te;
    }

    public List<Status> pollConsume() throws TwitterException {
        List<Status> list = te.getTwitter().getMentions(new Paging(lastId));
        for (Status s : list) {
            checkLastId(s.getId());
        }
        return list;
    }
View Full Code Here

TOP

Related Classes of twitter4j.Paging

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.