camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/8] camel git commit: CAMEL-11510: camel-twitter fixed paging to use page and count options, so you can get more data, in some of the twitter actions.
Date Wed, 05 Jul 2017 09:27:02 GMT
CAMEL-11510: camel-twitter fixed paging to use page and count options, so you can get more
data, in some of the twitter actions.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1a347d2d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1a347d2d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1a347d2d

Branch: refs/heads/master
Commit: 1a347d2d93ae441e2e0c5cfb65a2dfd5bd970c03
Parents: 509eab1
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jul 5 11:20:18 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 5 11:20:18 2017 +0200

----------------------------------------------------------------------
 .../twitter/consumer/AbstractTwitterConsumerHandler.java  | 10 +++++++++-
 .../component/twitter/timeline/HomeConsumerHandler.java   |  6 ++++--
 .../twitter/timeline/MentionsConsumerHandler.java         |  6 ++++--
 .../twitter/timeline/RetweetsConsumerHandler.java         |  6 ++++--
 .../component/twitter/timeline/UserConsumerHandler.java   |  6 ++++--
 5 files changed, 25 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1a347d2d/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/AbstractTwitterConsumerHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/AbstractTwitterConsumerHandler.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/AbstractTwitterConsumerHandler.java
index 1fa515b..9ccc6d5 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/AbstractTwitterConsumerHandler.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/AbstractTwitterConsumerHandler.java
@@ -84,6 +84,14 @@ public abstract class AbstractTwitterConsumerHandler {
     }
 
     protected Paging getLastIdPaging() {
-        return new Paging(lastId);
+        Integer pages = endpoint.getProperties().getNumberOfPages();
+        Integer count = endpoint.getProperties().getCount();
+        if (pages != null && count != null) {
+            return new Paging(pages, count, lastId);
+        } else if (pages != null) {
+            return new Paging(pages, lastId);
+        } else {
+            return new Paging(lastId);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/1a347d2d/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/HomeConsumerHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/HomeConsumerHandler.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/HomeConsumerHandler.java
index 2411e0a..9f65eba 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/HomeConsumerHandler.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/HomeConsumerHandler.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.twitter.timeline;
 import java.util.List;
 
 import org.apache.camel.component.twitter.TwitterEndpoint;
+import twitter4j.Paging;
 import twitter4j.Status;
 import twitter4j.TwitterException;
 
@@ -33,8 +34,9 @@ public class HomeConsumerHandler extends AbstractStatusConsumerHandler {
 
     @Override
     protected List<Status> doPoll() throws TwitterException {
-        log.trace("doPoll.getHomeTimeline(sinceId={})", getLastIdPaging().getSinceId());
-        return getTwitter().getHomeTimeline(getLastIdPaging());
+        Paging paging = getLastIdPaging();
+        log.trace("doPoll.getHomeTimeline(sinceId={})", paging.getSinceId());
+        return getTwitter().getHomeTimeline(paging);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/1a347d2d/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/MentionsConsumerHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/MentionsConsumerHandler.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/MentionsConsumerHandler.java
index 9601c99..58c6fc6 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/MentionsConsumerHandler.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/MentionsConsumerHandler.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.twitter.timeline;
 import java.util.List;
 
 import org.apache.camel.component.twitter.TwitterEndpoint;
+import twitter4j.Paging;
 import twitter4j.Status;
 import twitter4j.TwitterException;
 
@@ -33,8 +34,9 @@ public class MentionsConsumerHandler extends AbstractStatusConsumerHandler
{
 
     @Override
     protected List<Status> doPoll() throws TwitterException {
-        log.trace("doPoll.getMentionsTimeline(sinceId={})", getLastIdPaging().getSinceId());
-        return getTwitter().getMentionsTimeline(getLastIdPaging());
+        Paging paging = getLastIdPaging();
+        log.trace("doPoll.getMentionsTimeline(sinceId={})", paging.getSinceId());
+        return getTwitter().getMentionsTimeline(paging);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/1a347d2d/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/RetweetsConsumerHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/RetweetsConsumerHandler.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/RetweetsConsumerHandler.java
index a447e8e..67b4477 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/RetweetsConsumerHandler.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/RetweetsConsumerHandler.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.twitter.timeline;
 import java.util.List;
 
 import org.apache.camel.component.twitter.TwitterEndpoint;
+import twitter4j.Paging;
 import twitter4j.Status;
 import twitter4j.TwitterException;
 
@@ -33,8 +34,9 @@ public class RetweetsConsumerHandler extends AbstractStatusConsumerHandler
{
 
     @Override
     protected List<Status> doPoll() throws TwitterException {
-        log.trace("doPoll.getRetweetsOfMe(sinceId={})", getLastIdPaging().getSinceId());
-        return getTwitter().getRetweetsOfMe(getLastIdPaging());
+        Paging paging = getLastIdPaging();
+        log.trace("doPoll.getRetweetsOfMe(sinceId={})", paging.getSinceId());
+        return getTwitter().getRetweetsOfMe(paging);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/1a347d2d/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/UserConsumerHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/UserConsumerHandler.java
b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/UserConsumerHandler.java
index effe89f..027b0c3 100644
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/UserConsumerHandler.java
+++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/UserConsumerHandler.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.twitter.timeline;
 import java.util.List;
 
 import org.apache.camel.component.twitter.TwitterEndpoint;
+import twitter4j.Paging;
 import twitter4j.Status;
 import twitter4j.TwitterException;
 
@@ -36,8 +37,9 @@ public class UserConsumerHandler extends AbstractStatusConsumerHandler {
 
     @Override
     protected List<Status> doPoll() throws TwitterException {
-        log.trace("doPoll.getUserTimeline(user={}, sinceId={})", user, getLastIdPaging().getSinceId());
-        return getTwitter().getUserTimeline(user, getLastIdPaging());
+        Paging paging = getLastIdPaging();
+        log.trace("doPoll.getUserTimeline(user={}, sinceId={})", user, paging.getSinceId());
+        return getTwitter().getUserTimeline(user, paging);
     }
 
     @Override


Mime
View raw message