streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject [streams] branch master updated: STREAMS-681: add support for using fromDate and toDate in ThirtyDaySearchProvider
Date Wed, 11 Nov 2020 20:44:31 GMT
This is an automated email from the ASF dual-hosted git repository.

sblackmon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/streams.git


The following commit(s) were added to refs/heads/master by this push:
     new 4feff37  STREAMS-681: add support for using fromDate and toDate in ThirtyDaySearchProvider
4feff37 is described below

commit 4feff372e83fd71657c63c2edf123b30a27cd149
Author: sblackmon <sblackmon@apache.org>
AuthorDate: Wed Nov 11 14:04:55 2020 -0600

    STREAMS-681: add support for using fromDate and toDate in ThirtyDaySearchProvider
    
    resolves STREAMS-681
---
 .../apache/streams/twitter/provider/ThirtyDaySearchProvider.java   | 7 +++++++
 .../twitter/config/ThirtyDaySearchProviderConfiguration.json       | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/ThirtyDaySearchProvider.java
b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/ThirtyDaySearchProvider.java
index 6340c55..75db9d1 100644
--- a/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/ThirtyDaySearchProvider.java
+++ b/streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/provider/ThirtyDaySearchProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.streams.twitter.provider;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.streams.config.ComponentConfigurator;
 import org.apache.streams.config.StreamsConfiguration;
 import org.apache.streams.config.StreamsConfigurator;
@@ -177,6 +178,12 @@ public class ThirtyDaySearchProvider implements Callable<Iterator<Tweet>>,
Seria
     request.setQuery(config.getQuery());
     request.setTag(config.getTag());
     request.setMaxResults(config.getPageSize());
+    if( StringUtils.isNotBlank(request.getFromDate())) {
+      request.setFromDate(request.getFromDate());
+    }
+    if( StringUtils.isNotBlank(request.getToDate())) {
+      request.setToDate(request.getToDate());
+    }
     streamsConfiguration = StreamsConfigurator.detectConfiguration();
 
     try {
diff --git a/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/ThirtyDaySearchProviderConfiguration.json
b/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/ThirtyDaySearchProviderConfiguration.json
index c117b0f..e5006db 100644
--- a/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/ThirtyDaySearchProviderConfiguration.json
+++ b/streams-contrib/streams-provider-twitter/src/main/jsonschema/org/apache/streams/twitter/config/ThirtyDaySearchProviderConfiguration.json
@@ -26,6 +26,12 @@
     "page_size": {
       "type": "integer",
       "description": "Requested items per page"
+    },
+    "fromDate": {
+      "$ref": "../api/ThirtyDaySearchRequest.json#properties/fromDate"
+    },
+    "toDate": {
+      "$ref": "../api/ThirtyDaySearchRequest.json#properties/toDate"
     }
   }
 }
\ No newline at end of file


Mime
View raw message