streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reba...@apache.org
Subject [2/4] incubator-streams git commit: STREAMS-220 | Including Facebook object in extensions
Date Fri, 14 Nov 2014 17:52:09 GMT
STREAMS-220 | Including Facebook object in extensions


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

Branch: refs/heads/master
Commit: 3fa79f14614974e588828c6f70a99393bf833c10
Parents: 01efdda
Author: Robert Douglas <rdouglas@w2ogroup.com>
Authored: Thu Nov 13 09:48:51 2014 -0600
Committer: Robert Douglas <rdouglas@w2ogroup.com>
Committed: Thu Nov 13 09:48:51 2014 -0600

----------------------------------------------------------------------
 .../streams/facebook/serializer/FacebookActivityUtil.java      | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/3fa79f14/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
b/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
index af650ba..49f2880 100644
--- a/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
+++ b/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/serializer/FacebookActivityUtil.java
@@ -17,6 +17,8 @@
  */
 package org.apache.streams.facebook.serializer;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.google.common.base.Joiner;
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
@@ -25,6 +27,7 @@ import org.apache.streams.exceptions.ActivitySerializerException;
 import org.apache.streams.facebook.*;
 import org.apache.streams.facebook.Place;
 import org.apache.streams.facebook.Post;
+import org.apache.streams.jackson.StreamsJacksonMapper;
 import org.apache.streams.pojo.json.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -202,6 +205,7 @@ public class FacebookActivityUtil {
      * @param post
      */
     public static void buildExtensions(Activity activity, Post post) {
+        ObjectMapper mapper = StreamsJacksonMapper.getInstance();
         Map<String, Object> extensions = ensureExtensions(activity);
 
         if(post.getLikes() != null) {
@@ -241,6 +245,8 @@ public class FacebookActivityUtil {
                 extensions.put(LOCATION_EXTENSION, place.getAdditionalProperties().get("location"));
             }
         }
+
+        extensions.put("facebook", mapper.convertValue(post, ObjectNode.class));
     }
 
     /**


Mime
View raw message