streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfranklin <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Streams 105
Date Mon, 30 Jun 2014 12:35:03 GMT
Github user mfranklin commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/47#discussion_r14347360
  
    --- Diff: streams-contrib/streams-provider-datasift/src/main/java/org/apache/streams/datasift/serializer/DatasiftTweetActivitySerializer.java
---
    @@ -215,18 +217,22 @@ public void addTwitterExtensions(Activity activity, Twitter twitter,
Interaction
             }
     
             if(interaction.getAdditionalProperties() != null) {
    -            Object mentionsObject = interaction.getAdditionalProperties().get("mentions");
    -            if(mentionsObject != null ) {
    -                if(mentionsObject instanceof List) {
    -                    List mentions = (List) mentionsObject;
    -                    List<Map<String, Object>> userMentions = Lists.newLinkedList();
    -                    for(Object mention : mentions) {
    -                        Map<String, Object> actor = Maps.newHashMap();
    -                        actor.put("displayName", mention);
    -                        userMentions.add(actor);
    -                    }
    -                    extensions.put("user_mentions", userMentions);
    +            ArrayList<String> mentions = (ArrayList<String>) interaction.getAdditionalProperties().get("mentions");
    +            ArrayList<Long> mentionIds = (ArrayList<Long>) interaction.getAdditionalProperties().get("mention_ids");
    +            ArrayList<UserMentions> userMentions = new ArrayList<UserMentions>();
    +
    +            if(mentions != null && mentionIds != null && (mentionIds.size()
== mentions.size()) && !mentions.isEmpty() && !mentionIds.isEmpty()) {
    --- End diff --
    
    IMO, even if they are not the same size, it is valuable to insert both lists.  We just
need to caveat in the documentation for this provider that the IDs list does not correspond
1:1 with the handles list.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message