streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject [01/15] git commit: additional fields streamlines instagram-specific logic
Date Thu, 28 Aug 2014 19:26:46 GMT
Repository: incubator-streams
Updated Branches:
  refs/heads/master 6b632def6 -> 67ab1ff6e


additional fields
streamlines instagram-specific logic


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

Branch: refs/heads/master
Commit: 4cb20a161f0881fda4adfeeb18e5618cc0bf4c6e
Parents: be5a936
Author: sblackmon <sblackmon@w2odigital.com>
Authored: Mon Aug 11 12:34:29 2014 -0500
Committer: sblackmon <sblackmon@apache.org>
Committed: Tue Aug 12 18:04:23 2014 -0500

----------------------------------------------------------------------
 .../DatasiftInstagramActivitySerializer.java    | 22 +++----
 .../main/jsonschema/com/datasift/Datasift.json  | 63 ++++++++++++++++++++
 2 files changed, 74 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/4cb20a16/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/serializer/DatasiftInstagramActivitySerializer.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/serializer/DatasiftInstagramActivitySerializer.java
b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/serializer/DatasiftInstagramActivitySerializer.java
index 54f14af..4149fe3 100644
--- a/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/serializer/DatasiftInstagramActivitySerializer.java
+++ b/streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/serializer/DatasiftInstagramActivitySerializer.java
@@ -56,15 +56,9 @@ public class DatasiftInstagramActivitySerializer extends DatasiftDefaultActivity
         Instagram instagram = event.getInstagram();
 
         activity.setActor(buildActor(event, instagram));
-        activity.setObject(buildActivityObject(event.getInteraction()));
         activity.setId(formatId(activity.getVerb(), event.getInteraction().getId()));
-        activity.setTarget(buildTarget(event.getInteraction()));
-        activity.setPublished(event.getInteraction().getCreatedAt());
-        activity.setGenerator(buildGenerator(event.getInteraction()));
-        activity.setIcon(getIcon(event.getInteraction()));
         activity.setProvider(InstagramActivityUtil.getProvider());
-        activity.setTitle(event.getInteraction().getTitle());
-        activity.setUrl(event.getInteraction().getLink());
+        activity.setLinks(getLinks(event.getInstagram()));
 
         activity.setVerb(selectVerb(event));
         addInstagramExtensions(activity, instagram);
@@ -77,8 +71,10 @@ public class DatasiftInstagramActivitySerializer extends DatasiftDefaultActivity
      */
     private List<String> getLinks(Instagram instagram) {
         List<String> result = Lists.newLinkedList();
-        result.add(instagram.getMedia().getImage());
-        result.add(instagram.getMedia().getVideo());
+        if( instagram.getMedia() != null ) {
+            result.add(instagram.getMedia().getImage());
+            result.add(instagram.getMedia().getVideo());
+        }
         return result;
     }
 
@@ -106,8 +102,12 @@ public class DatasiftInstagramActivitySerializer extends DatasiftDefaultActivity
         if(instagram.getMedia() != null) {
             hashTags = instagram.getMedia().getTags();
             extensions.put("hashtags", hashTags);
-            extensions.put("keywords", instagram.getMedia().getCaption());
+            extensions.put("keywords", activity.getContent());
+        } else {
+            extensions.put("keywords", activity.getContent());
+
         }
+
     }
 
     private String selectVerb(Datasift event) {
@@ -118,7 +118,7 @@ public class DatasiftInstagramActivitySerializer extends DatasiftDefaultActivity
     }
 
     public static String formatId(String... idparts) {
-        return Joiner.on(":").join(Lists.asList("id:twitter", idparts));
+        return Joiner.on(":").join(Lists.asList("id:instagram", idparts));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/4cb20a16/streams-contrib/streams-provider-datasift/src/main/jsonschema/com/datasift/Datasift.json
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-datasift/src/main/jsonschema/com/datasift/Datasift.json
b/streams-contrib/streams-provider-datasift/src/main/jsonschema/com/datasift/Datasift.json
index fdf1aac..0c21302 100644
--- a/streams-contrib/streams-provider-datasift/src/main/jsonschema/com/datasift/Datasift.json
+++ b/streams-contrib/streams-provider-datasift/src/main/jsonschema/com/datasift/Datasift.json
@@ -154,6 +154,46 @@
             "javaType": "org.apache.streams.datasift.instagram.Instagram",
             "type": "object",
             "properties": {
+                "caption": {
+                    "type": "object",
+                    "properties": {
+                        "created_time": {
+                            "type": "number"
+                        },
+                        "id": {
+                            "type": "string"
+                        },
+                        "text": {
+                            "type": "string"
+                        },
+                        "from": {
+                            "type": "object",
+                            "properties": {
+                                "full_name": {
+                                    "type": "array",
+                                    "items": [
+                                        {
+                                            "type": "string"
+                                        }
+                                    ]
+                                },
+                                "id": {
+                                    "type": "string"
+                                },
+                                "profile_picture": {
+                                    "type": "string"
+                                },
+                                "username": {
+                                    "type": "string"
+                                }
+                            }
+                        }
+                    }
+                },
+                "created_at": {
+                    "type": "string",
+                    "format": "date-time"
+                },
                 "from": {
                     "javaType": "org.apache.streams.datasift.instagram.From",
                     "type": "object",
@@ -177,6 +217,23 @@
                         }
                     }
                 },
+                "id": {
+                    "type": "string"
+                },
+                "images": {
+                    "type": "object",
+                    "properties": {
+                        "low_resolution": {
+                            "type": "object"
+                        },
+                        "standard_resolution": {
+                            "type": "object"
+                        },
+                        "thumbnail": {
+                            "type": "object"
+                        }
+                    }
+                },
                 "media": {
                     "javaType": "org.apache.streams.datasift.instagram.Media",
                     "type": "object",
@@ -216,6 +273,12 @@
                         }
                     }
                 },
+                "tags": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
                 "type": {
                     "type": "string"
                 }


Mime
View raw message