TweetDBObject result = new TweetDBObject();
result.setId( s.getId() );
- result.setFollowing(following + "");
String date = null;
if (s.getCreatedAt() != null) {
userCreated = sdf.format(s.getCreatedAt());
}
result.setCreated( userCreated );
-
+ result.setDescription( u.getDescription() );
+ result.setUserFavorite( u.getFavouritesCount() );
+ result.setFollowers( u.getFollowersCount() );
+ result.setFriend( u.getFriendsCount() );
+ result.setUserId( u.getId() );
+ result.setLang( u.getLang() );
+ result.setLocation( u.getLocation() );
+ result.setName( u.getName() );
+ result.setProfileBackgroundColor( u.getProfileBackgroundColor() );
+ result.setProfileBackgroundImageURL( u.getProfileBackgroundImageUrl() );
+ result.setProfileImageURL( u.getProfileImageURL().toString() );
+ result.setProfileSidebarBorderColor( u.getProfileSidebarBorderColor() );
+ result.setProfileSidebarFillColor( u.getProfileSidebarFillColor() );
+ result.setProfileTextColor( u.getProfileTextColor() );
+ result.setScreenName( u.getScreenName() );
+ result.setStatusesCount( u.getStatusesCount() );
+ result.setTimeZone( u.getTimeZone() );
+ if( u.getURL() != null ) {
+ result.setUrl( u.getURL().toString() );
+ }else {
+ result.setUrl("");
+ }
+ result.setUtc( u.getUtcOffset() );
+ result.setContributorsEnable( u.isContributorsEnabled() + "" );
+ result.setGeoEnable( u.isGeoEnabled() + "");
+ result.setProfileBackgroundTiled( u.isProfileBackgroundTiled() + "");
+ result.setIsProtected( u.isProtected() + "");
+ result.setVerified( u.isVerified() + "");
}
+ result.setSource( s.getSource() );
+ result.setFavorite( s.isFavorited() + "");
+ result.setRetweet( s.isRetweet() + "");
+ result.setTruncated( s.isTruncated() + "");
+
return result;
}
}
private long id;
- private String following;
private String date;
private long replyStatusID;
private long replyUserID;
public long getFollowers() {
return followers;
}
- public String getFollowing() {
- return following;
- }
public long getFriend() {
return friend;
}
public void setFollowers(long followers) {
this.followers = followers;
}
- public void setFollowing(String following) {
- this.following = following;
- }
public void setFriend(long friend) {
this.friend = friend;
}
public String toString() {
return "TweetDBObject [contributorsEnable=" + contributorsEnable
+ ", created=" + created + ", date=" + date + ", favorite="
- + favorite + ", followers=" + followers + ", following="
- + following + ", friend=" + friend + ", geoEnable=" + geoEnable
+ + favorite + ", followers=" + followers
+ + ", friend=" + friend + ", geoEnable=" + geoEnable
+ ", id=" + id + ", isProtected=" + isProtected + ", lang="
+ lang + ", location=" + location + ", name=" + name
+ ", profileBackgroundColor=" + profileBackgroundColor
private Connection databaseConnection = null;
//データベーステーブルの定義
- private static final String createTableSql =
+ private static final String createTweetTableSql =
"CREATE TABLE IF NOT EXISTS TWEET(" +
" id INTEGER PRIMARY KEY," +
- " following TEXT," +
" date TEXT," +
" replyStatusID INTEGER," +
" replyUserID INTEGER," +
" truncated TEXT)" ;
//データ挿入SQL
- private static final String insertDataSql =
- "INSERT INTO TWEET VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
+ private static final String insertTweetDataSql =
+ "INSERT INTO TWEET VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
//データ取得SQL
- private static final String selectDataSql =
+ private static final String selectTweetDataSql =
"SELECT * FROM TWEET;";
/**
Statement statement;
try {
statement = this.databaseConnection.createStatement();
- statement.execute( createTableSql );
+ statement.execute( createTweetTableSql );
} catch (SQLException e) {
e.printStackTrace();
}
QueryRunner qr = new QueryRunner();
//データ挿入
try {
- qr.update(con, insertDataSql,
+ qr.update(con, insertTweetDataSql,
o.getId(),
- o.getFollowing(),
o.getDate(),
o.getReplyStatusID(),
o.getReplyUserID(),
o.getTruncated() );
}catch(SQLException e) {
//挿入ではなく更新にする
+ e.printStackTrace();
}
con.close();
}
-
- public static void main(String[] args) {
- TwitterLogDao dao = new TwitterLogDao();
- dao.connectDB();
-
- dao.createTable();
-
- dao.closeDB();
- }
}