streams-dev mailing list archives

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

    https://github.com/apache/incubator-streams/pull/47#discussion_r14359174
  
    --- 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 --
    
    Ok, the approach that I'm currently taking is to merge them into individual UserMentions
objects if the lists are the same size. If they are not, then I'm creating UserMention objects
for every entry in both the IDs and Handles lists. I'll ping the dev list to see what everyone's
thoughts are.


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