Permalink
Browse files

SOCIALTW-29: Added retweeted property to Tweet object.

  • Loading branch information...
1 parent ae83851 commit 71cb7d9885569f9965bfda9d48c7557a874c5545 Craig Walls committed Feb 27, 2012
@@ -33,6 +33,7 @@
private String languageCode;
private String source;
private Integer retweetCount;
+ private boolean retweeted;
public Tweet(long id, String text, Date createdAt, String fromUser, String profileImageUrl, Long toUserId, long fromUserId, String languageCode, String source) {
this.id = id;
@@ -138,4 +139,12 @@ public void setRetweetCount(Integer retweetCount) {
public Integer getRetweetCount() {
return retweetCount;
}
+
+ public void setRetweeted(boolean retweeted) {
+ this.retweeted = retweeted;
+ }
+
+ public boolean isRetweeted() {
+ return retweeted;
+ }
}
@@ -69,6 +69,9 @@ public Tweet deserialize(JsonParser jp, DeserializationContext ctxt) throws IOEx
JsonNode retweetCountNode = tree.get("retweet_count");
Integer retweetCount = retweetCountNode != null && !retweetCountNode.isNull() ? retweetCountNode.getIntValue() : null;
tweet.setRetweetCount(retweetCount);
+ JsonNode retweetedNode = tree.get("retweeted");
+ boolean retweeted = retweetedNode != null && !retweetedNode.isNull() ? retweetedNode.getBooleanValue() : false;
+ tweet.setRetweeted(retweeted);
jp.skipChildren();
return tweet;
}
@@ -64,9 +64,10 @@ protected void assertSingleTweet(Tweet tweet, boolean isSearchResult) {
assertEquals("http://a3.twimg.com/profile_images/1205746571/me2_300.jpg", tweet.getProfileImageUrl());
assertEquals("Spring Social Showcase", tweet.getSource());
assertEquals(1279042701000L, tweet.getCreatedAt().getTime());
- assertEquals(Long.valueOf(123123123123L), tweet.getInReplyToStatusId());
+ assertEquals(Long.valueOf(123123123123L), tweet.getInReplyToStatusId());
if (!isSearchResult) {
assertEquals(12, tweet.getRetweetCount().intValue());
+ assertTrue(tweet.isRetweeted());
} else {
assertNull(tweet.getRetweetCount());
}
@@ -11,7 +11,8 @@
"source" : "Spring Social Showcase",
"in_reply_to_user_id" : "332211",
"retweet_count" : 12,
- "created_at" : "Tue Jul 13 17:38:21 +0000 2010"
+ "created_at" : "Tue Jul 13 17:38:21 +0000 2010",
+ "retweeted" : true
},
{
"id" : "54321",
@@ -10,5 +10,6 @@
"source" : "Spring Social Showcase",
"in_reply_to_user_id" : "332211",
"retweet_count" : 12,
- "created_at" : "Tue Jul 13 17:38:21 +0000 2010"
+ "created_at" : "Tue Jul 13 17:38:21 +0000 2010",
+ "retweeted" : true
}
@@ -11,7 +11,8 @@
"in_reply_to_user_id" : "332211",
"retweet_count" : 12,
"in_reply_to_status_id" : 123123123123,
- "created_at" : "Tue Jul 13 17:38:21 +0000 2010"
+ "created_at" : "Tue Jul 13 17:38:21 +0000 2010",
+ "retweeted" : true
},
{
"id" : 54321,

0 comments on commit 71cb7d9

Please sign in to comment.