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 16:18:20 GMT
Github user mfranklin commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/47#discussion_r14359066
  
    --- 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 --
    
    Since there is no 100% completely accurate way to assert the IDs match the handles, then
I would say create a different object for each and let a downstream processor merge them by
checking twitter API.  Either that or completely disregard one or the other.  
    
    You might want to discuss this on the list to get other opinions.


---
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