streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject git commit: additional feature : generate CSDL for general listening
Date Mon, 16 Jun 2014 21:17:46 GMT
Repository: incubator-streams
Updated Branches:
  refs/heads/STREAMS-109 9ad1e046e -> d63a27a44


additional feature : generate CSDL for general listening


Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/d63a27a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/d63a27a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/d63a27a4

Branch: refs/heads/STREAMS-109
Commit: d63a27a446de21a7360bca190900bc6748945c43
Parents: 9ad1e04
Author: sblackmon <sblackmon@w2odigital.com>
Authored: Mon Jun 16 16:17:38 2014 -0500
Committer: sblackmon <sblackmon@w2odigital.com>
Committed: Mon Jun 16 16:17:38 2014 -0500

----------------------------------------------------------------------
 .../streams/datasift/csdl/DatasiftCsdlUtil.java | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/d63a27a4/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/csdl/DatasiftCsdlUtil.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/csdl/DatasiftCsdlUtil.java
b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/csdl/DatasiftCsdlUtil.java
index 1a941c6..e317e51 100644
--- a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/csdl/DatasiftCsdlUtil.java
+++ b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/csdl/DatasiftCsdlUtil.java
@@ -83,4 +83,32 @@ public class DatasiftCsdlUtil {
 
         return csdlBuilder.toString();
 	}
+
+    public static String csdlFromKeywords(List<String> include, List<String>
exclude) throws Exception {
+
+        StringBuilder csdlBuilder = new StringBuilder();
+
+        csdlBuilder.append("interaction.content contains_any \"");
+        ListIterator<String> listIterator = Lists.newArrayList(include).listIterator();
+        while( listIterator.hasNext() ) {
+            csdlBuilder.append(listIterator.next());
+            if (listIterator.hasNext())
+                csdlBuilder.append(",");
+        }
+        csdlBuilder.append("\"\n");
+        csdlBuilder.append(" AND NOT ( \n");
+        csdlBuilder.append("interaction.content \"");
+        listIterator = Lists.newArrayList(exclude).listIterator();
+        while( listIterator.hasNext() ) {
+            csdlBuilder.append(listIterator.next());
+            if (listIterator.hasNext())
+                csdlBuilder.append(",");
+        }
+        csdlBuilder.append("\"\n");
+        csdlBuilder.append(")\n");
+
+        log.debug(csdlBuilder.toString());
+
+        return csdlBuilder.toString();
+    }
 }


Mime
View raw message