List of usage examples for twitter4j User getId
long getId();
From source file:DataCollections.UserHelper.java
public User_dbo convertUserToUser_dbo(User user) { User_dbo u = new User_dbo(); u.values[User_dbo.map.get("user_id")].setValue(String.valueOf(user.getId())); u.values[User_dbo.map.get("name")].setValue(removeEscapeCharacters(user.getName())); u.values[User_dbo.map.get("screename")].setValue(removeEscapeCharacters(user.getScreenName())); u.values[User_dbo.map.get("lang")].setValue(user.getLang()); u.values[User_dbo.map.get("location")].setValue(removeEscapeCharacters(user.getLocation())); u.values[User_dbo.map.get("geoenabled")].setValue(String.valueOf(user.isGeoEnabled())); u.values[User_dbo.map.get("timezone")].setValue(user.getTimeZone()); u.values[User_dbo.map.get("profileurl")].setValue(user.getURL()); u.values[User_dbo.map.get("protected")].setValue(String.valueOf(user.isProtected())); u.values[User_dbo.map.get("verified")].setValue(String.valueOf(user.isVerified())); u.values[User_dbo.map.get("description")].setValue(removeEscapeCharacters(user.getDescription())); if (geoinfoavailable) { double[] geocoor = geohelper.searchGeoLocCoor(user.getLocation()); u.values[User_dbo.map.get("probased_geoinfo")].setValue(String.valueOf("true")); //u.values[User_dbo.map.get("descbased_geoinfo")].setValue(String.valueOf("false")); u.values[User_dbo.map.get("probased_lat")].setValue(String.valueOf(geocoor[0])); u.values[User_dbo.map.get("probased_lon")].setValue(String.valueOf(geocoor[1])); }//from w ww .j ava 2 s. c o m u.values[User_dbo.map.get("udetails_processed")].setValue(String.valueOf(true)); u.values[User_dbo.map.get("totaltweets")].setValue(String.valueOf(user.getStatusesCount())); return u; }
From source file:de.binfalse.jatter.processors.JabberMessageProcessor.java
License:Open Source License
/** * Translate user.//from w w w.j a v a 2 s . c o m * * @param user the user * @param profile the profile * @return the string */ public static String translateUser(User user, String profile) { String ret = "profile of *" + profile + "*\n" + "name: " + user.getName() + "\n" + "screen name: " + user.getScreenName() + "\n" + "id: " + user.getId() + "\n"; if (user.getDescription() != null) ret += "description: " + user.getDescription() + "\n"; if (user.getURL() != null) ret += "url: " + JatterTools.expandUrl(user.getURL()) + "\n"; if (user.getLang() != null) ret += "language: " + user.getLang() + "\n"; if (user.getLocation() != null) ret += "location: " + user.getLocation() + "\n"; if (user.getTimeZone() != null) ret += "time zone: " + user.getTimeZone() + "\n"; ret += "tweets: " + user.getStatusesCount() + "\n"; ret += "favourites: " + user.getFavouritesCount() + "\n"; ret += "followers: " + user.getFollowersCount() + "\n"; ret += "friends: " + user.getFriendsCount() + "\n"; if (user.getStatus() != null) ret += "last status: " + TwitterStatusProcessor.translateTwitterStatus(user.getStatus()); return ret; }
From source file:de.jetwick.data.JUser.java
License:Apache License
/** * This method refreshes the properties of this user by the specified * Twitter4j user/*from w w w . j av a 2 s .co m*/ * @param user */ public Status updateFieldsBy(User user) { twitterId = user.getId(); setProtected(user.isProtected()); setTwitterCreatedAt(user.getCreatedAt()); setDescription(user.getDescription()); addLanguage(user.getLang()); setLocation(TwitterSearch.toStandardLocation(user.getLocation())); setRealName(user.getName()); // user.getFollowersCount(); // user.getFriendsCount(); // user.getTimeZone() if (user.getProfileImageURL() != null) setProfileImageUrl(user.getProfileImageURL().toString()); if (user.getURL() != null) setWebUrl(user.getURL().toString()); setFollowersCount(user.getFollowersCount()); setFriendsCount(user.getFriendsCount()); return user.getStatus(); }
From source file:de.jetwick.tw.Twitter4JUser.java
License:Apache License
@Override public int compareTo(User o) { if (id < o.getId()) return -1; else if (id > o.getId()) return 1; return 0;//from ww w. ja v a 2 s. co m }
From source file:de.vanita5.twittnuker.loader.support.ParcelableUserLoader.java
License:Open Source License
private static User showUserAlternative(final Twitter twitter, final long id, final String screenName) throws TwitterException { final String searchScreenName; if (screenName != null) { searchScreenName = screenName;/* w w w.ja v a2 s . c om*/ } else if (id != -1) { searchScreenName = twitter.showFriendship(twitter.getId(), id).getTargetUserScreenName(); } else return null; for (final User user : twitter.searchUsers(searchScreenName, 1)) { if (user.getId() == id || searchScreenName.equals(user.getScreenName())) return user; } return null; }
From source file:de.vanita5.twittnuker.loader.support.Twitter4JUsersLoader.java
License:Open Source License
@Override public List<ParcelableUser> loadInBackground() { final List<ParcelableUser> data = getData(); final List<User> users; try {/* w ww . j ava 2 s . c o m*/ users = getUsers(getTwitterInstance(mContext, mAccountId, true)); if (users == null) return data; } catch (final TwitterException e) { e.printStackTrace(); return data; } int pos = data.size(); for (final User user : users) { if (hasId(user.getId())) { continue; } data.add(new ParcelableUser(user, mAccountId, pos)); pos++; } Collections.sort(data); return data; }
From source file:de.vanita5.twittnuker.model.ParcelableDirectMessage.java
License:Open Source License
public ParcelableDirectMessage(final DirectMessage message, final long account_id, final boolean is_outgoing) { this.account_id = account_id; this.is_outgoing = is_outgoing; final User sender = message.getSender(), recipient = message.getRecipient(); final String sender_profile_image_url_string = sender != null ? ParseUtils.parseString(sender.getProfileImageUrlHttps()) : null;/* ww w . ja v a2s . com*/ final String recipient_profile_image_url_string = recipient != null ? ParseUtils.parseString(recipient.getProfileImageUrlHttps()) : null; id = message.getId(); timestamp = getTime(message.getCreatedAt()); sender_id = sender != null ? sender.getId() : -1; recipient_id = recipient != null ? recipient.getId() : -1; text_html = formatDirectMessageText(message); text_plain = message.getText(); sender_name = sender != null ? sender.getName() : null; recipient_name = recipient != null ? recipient.getName() : null; sender_screen_name = sender != null ? sender.getScreenName() : null; recipient_screen_name = recipient != null ? recipient.getScreenName() : null; sender_profile_image_url = sender_profile_image_url_string; recipient_profile_image_url = recipient_profile_image_url_string; text_unescaped = toPlainText(text_html); medias = ParcelableMedia.fromEntities(message); first_media = medias != null && medias.length > 0 ? medias[0].url : null; }
From source file:de.vanita5.twittnuker.model.ParcelableStatus.java
License:Open Source License
public ParcelableStatus(final Status orig, final long account_id, final boolean is_gap) { this.is_gap = is_gap; this.account_id = account_id; id = orig.getId();/*from w w w .ja va2 s. c om*/ timestamp = getTime(orig.getCreatedAt()); is_retweet = orig.isRetweet(); final Status retweeted = orig.getRetweetedStatus(); final User retweet_user = retweeted != null ? orig.getUser() : null; retweet_id = retweeted != null ? retweeted.getId() : -1; //NOTE getTime(orig.getCreatedAt()) retweet_timestamp = retweeted != null ? getTime(retweeted.getCreatedAt()) : -1; retweeted_by_id = retweet_user != null ? retweet_user.getId() : -1; retweeted_by_name = retweet_user != null ? retweet_user.getName() : null; retweeted_by_screen_name = retweet_user != null ? retweet_user.getScreenName() : null; retweeted_by_profile_image = retweet_user != null ? ParseUtils.parseString(retweet_user.getProfileImageUrlHttps()) : null; final Status status = retweeted != null ? retweeted : orig; final User user = status.getUser(); user_id = user.getId(); user_name = user.getName(); user_screen_name = user.getScreenName(); user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps()); user_is_protected = user.isProtected(); user_is_verified = user.isVerified(); user_is_following = user.isFollowing(); text_html = formatStatusText(status); media = ParcelableMedia.fromEntities(status); text_plain = status.getText(); retweet_count = status.getRetweetCount(); favorite_count = status.getFavoriteCount(); reply_count = status.getReplyCount(); descendent_reply_count = status.getDescendentReplyCount(); in_reply_to_name = getInReplyToName(status); in_reply_to_screen_name = status.getInReplyToScreenName(); in_reply_to_status_id = status.getInReplyToStatusId(); in_reply_to_user_id = status.getInReplyToUserId(); source = status.getSource(); location = new ParcelableLocation(status.getGeoLocation()); is_favorite = status.isFavorited(); text_unescaped = toPlainText(text_html); my_retweet_id = retweeted_by_id == account_id ? id : -1; is_possibly_sensitive = status.isPossiblySensitive(); mentions = ParcelableUserMention.fromUserMentionEntities(status.getUserMentionEntities()); first_media = media != null && media.length > 0 ? media[0].url : null; }
From source file:de.vanita5.twittnuker.model.ParcelableUser.java
License:Open Source License
public ParcelableUser(final User user, final long account_id, final long position) { this.position = position; this.account_id = account_id; final URLEntity[] urls_url_entities = user.getURLEntities(); id = user.getId(); created_at = getTime(user.getCreatedAt()); is_protected = user.isProtected(); is_verified = user.isVerified();//from w w w. j a v a 2s. co m name = user.getName(); screen_name = user.getScreenName(); description_plain = user.getDescription(); description_html = formatUserDescription(user); description_expanded = formatExpandedUserDescription(user); location = user.getLocation(); profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps()); profile_banner_url = user.getProfileBannerImageUrl(); url = ParseUtils.parseString(user.getURL()); url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0 ? ParseUtils.parseString(urls_url_entities[0].getExpandedURL()) : null; is_follow_request_sent = user.isFollowRequestSent(); followers_count = user.getFollowersCount(); friends_count = user.getFriendsCount(); statuses_count = user.getStatusesCount(); favorites_count = user.getFavouritesCount(); listed_count = user.getListedCount(); is_cache = false; is_following = user.isFollowing(); description_unescaped = toPlainText(description_html); }
From source file:de.vanita5.twittnuker.model.ParcelableUserList.java
License:Open Source License
public ParcelableUserList(final UserList list, final long account_id, final long position, final boolean is_following) { final User user = list.getUser(); this.position = position; this.account_id = account_id; id = list.getId();//from w w w . j a v a 2 s.c o m is_public = list.isPublic(); this.is_following = is_following; name = list.getName(); description = list.getDescription(); user_id = user.getId(); user_name = user.getName(); user_screen_name = user.getScreenName(); user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps()); members_count = list.getMemberCount(); subscribers_count = list.getSubscriberCount(); }