streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject [12/13] git commit: utilize improved JsonCleaner within TypeConverter
Date Tue, 12 Aug 2014 23:04:56 GMT
utilize improved JsonCleaner within TypeConverter


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

Branch: refs/heads/STREAMS-142
Commit: 614f403448a6f19c563a75cf9cb2a8698d628cdc
Parents: 4e3d769
Author: sblackmon <sblackmon@apache.org>
Authored: Mon Aug 11 19:21:51 2014 -0500
Committer: sblackmon <sblackmon@apache.org>
Committed: Tue Aug 12 18:04:24 2014 -0500

----------------------------------------------------------------------
 .../CleanAdditionalPropertiesProcessor.java        |  2 +-
 .../processor/DatasiftTypeConverterProcessor.java  | 17 +----------------
 2 files changed, 2 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/614f4034/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/CleanAdditionalPropertiesProcessor.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/CleanAdditionalPropertiesProcessor.java
b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/CleanAdditionalPropertiesProcessor.java
index cc770db..00f08e7 100644
--- a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/CleanAdditionalPropertiesProcessor.java
+++ b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/CleanAdditionalPropertiesProcessor.java
@@ -48,7 +48,7 @@ public class CleanAdditionalPropertiesProcessor implements StreamsProcessor
{
 
     }
 
-    public void cleanAdditionalProperties(ObjectNode node) {
+    public static void cleanAdditionalProperties(ObjectNode node) {
         if( node.get("additionalProperties") != null ) {
             ObjectNode additionalProperties = (ObjectNode) node.get("additionalProperties");
             cleanAdditionalProperties(additionalProperties);

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/614f4034/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/DatasiftTypeConverterProcessor.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/DatasiftTypeConverterProcessor.java
b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/DatasiftTypeConverterProcessor.java
index 680c7ea..e85e8b1 100644
--- a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/DatasiftTypeConverterProcessor.java
+++ b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/processor/DatasiftTypeConverterProcessor.java
@@ -115,20 +115,7 @@ public class DatasiftTypeConverterProcessor implements StreamsProcessor
{
                 } else {
                     if(toConvert.getClass().equals(Activity.class)) { //hack to remove additional
properties
                         ObjectNode node = mapper.convertValue(toConvert, ObjectNode.class);
-                        if(node.has("additionalProperties")) {
-                            ObjectNode additionalProperties = (ObjectNode) node.get("additionalProperties");
-//                            node.put("user_mentions", additionalProperties.get("user_mentions"));
-                            node.putAll(additionalProperties);
-                            node.remove("additionalProperties");
-                        }
-                        if(node.has("actor")) {
-                            ObjectNode actor = (ObjectNode) node.get("actor");
-                            if(actor.has("additionalProperties")) {
-                                ObjectNode additionalProperties = (ObjectNode) actor.get("additionalProperties");
-                                actor.putAll(additionalProperties);
-                                actor.remove("additionalProperties");
-                            }
-                        }
+                        CleanAdditionalPropertiesProcessor.cleanAdditionalProperties(node);
                         return mapper.writeValueAsString(node);
                     } else
                         return mapper.writeValueAsString(toConvert);
@@ -139,8 +126,6 @@ public class DatasiftTypeConverterProcessor implements StreamsProcessor
{
                 return null;
             }
         }
-
-
     }
 
     private class DefaultConverter implements DatasiftConverter {


Mime
View raw message