Example usage for twitter4j User getStatusesCount

List of usage examples for twitter4j User getStatusesCount

Introduction

In this page you can find the example usage for twitter4j User getStatusesCount.

Prototype

int getStatusesCount();

Source Link

Usage

From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java

License:Apache License

void merge(@NonNull User u, @NonNull Realm realm) {
    if (u.getDescription() != null) { // description is nullable
        this.description = u.getDescription();
        final URLEntity[] descriptionURLEntities = u.getDescriptionURLEntities();
        if (descriptionURLEntities != null && descriptionURLEntities.length > 0) {
            this.descriptionURLEntities.clear();
            for (URLEntity url : descriptionURLEntities) {
                this.descriptionURLEntities.add(URLEntityRealm.findOrCreateFromRealm(url, realm));
            }/*from   w  w  w.j a  va 2s.  c  om*/
        }
    }
    this.favoritesCount = u.getFavouritesCount();
    this.followersCount = u.getFollowersCount();
    this.friendsCount = u.getFriendsCount();
    this.miniProfileImageURLHttps = u.getMiniProfileImageURLHttps();
    this.name = u.getName();
    this.profileBannerMobileURL = u.getProfileBannerMobileURL();
    this.profileImageURLHttps = u.getProfileImageURLHttps();
    this.profileLinkColor = u.getProfileLinkColor();
    this.screenName = u.getScreenName();
    this.statusesCount = u.getStatusesCount();
    this.url = u.getURL();
    final URLEntity urlEntity = u.getURLEntity();
    if (urlEntity != null && isNewUrlEntity(urlEntity)) {
        this.urlEntity = URLEntityRealm.findOrCreateFromRealm(urlEntity, realm);
    }
    this.location = u.getLocation();
    this.verified = u.isVerified();
    this.isProtected = u.isProtected();
}

From source file:com.freshdigitable.udonroad.TimelineInstTestBase.java

License:Apache License

protected int setupDefaultUserInfoTimeline() throws TwitterException {
    final User loginUser = getLoginUser();
    final ResponseList<Status> responseList = createDefaultResponseList(loginUser);
    this.responseList = responseList;
    final ResponseList<Status> emptyStatusResponseList = createResponseList();

    final int size = responseList.size();
    when(loginUser.getStatusesCount()).thenReturn(size);
    when(twitter.getUserTimeline(loginUser.getId())).thenReturn(responseList);
    when(twitter.getUserTimeline(anyLong(), any(Paging.class))).thenReturn(emptyStatusResponseList);
    when(twitter.getFavorites(anyLong())).thenReturn(emptyStatusResponseList);
    final PagableResponseList<User> emptyUserPagableResponseList = mock(PagableResponseList.class);
    when(twitter.getFollowersList(anyLong(), anyLong())).thenReturn(emptyUserPagableResponseList);
    when(twitter.getFriendsList(anyLong(), anyLong())).thenReturn(emptyUserPagableResponseList);

    final Relationship relationship = mock(Relationship.class);
    when(relationship.isSourceFollowingTarget()).thenReturn(true);
    when(relationship.isSourceMutingTarget()).thenReturn(false);
    when(twitter.showFriendship(anyLong(), anyLong())).thenReturn(relationship);
    return responseList.size();
}

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

public static void convert(User user, Struct struct) {
    struct.put("Id", user.getId()).put("Name", user.getName()).put("ScreenName", user.getScreenName())
            .put("Location", user.getLocation()).put("Description", user.getDescription())
            .put("ContributorsEnabled", user.isContributorsEnabled())
            .put("ProfileImageURL", user.getProfileImageURL())
            .put("BiggerProfileImageURL", user.getBiggerProfileImageURL())
            .put("MiniProfileImageURL", user.getMiniProfileImageURL())
            .put("OriginalProfileImageURL", user.getOriginalProfileImageURL())
            .put("ProfileImageURLHttps", user.getProfileImageURLHttps())
            .put("BiggerProfileImageURLHttps", user.getBiggerProfileImageURLHttps())
            .put("MiniProfileImageURLHttps", user.getMiniProfileImageURLHttps())
            .put("OriginalProfileImageURLHttps", user.getOriginalProfileImageURLHttps())
            .put("DefaultProfileImage", user.isDefaultProfileImage()).put("URL", user.getURL())
            .put("Protected", user.isProtected()).put("FollowersCount", user.getFollowersCount())
            .put("ProfileBackgroundColor", user.getProfileBackgroundColor())
            .put("ProfileTextColor", user.getProfileTextColor())
            .put("ProfileLinkColor", user.getProfileLinkColor())
            .put("ProfileSidebarFillColor", user.getProfileSidebarFillColor())
            .put("ProfileSidebarBorderColor", user.getProfileSidebarBorderColor())
            .put("ProfileUseBackgroundImage", user.isProfileUseBackgroundImage())
            .put("DefaultProfile", user.isDefaultProfile())
            .put("ShowAllInlineMedia", user.isShowAllInlineMedia()).put("FriendsCount", user.getFriendsCount())
            .put("CreatedAt", user.getCreatedAt()).put("FavouritesCount", user.getFavouritesCount())
            .put("UtcOffset", user.getUtcOffset()).put("TimeZone", user.getTimeZone())
            .put("ProfileBackgroundImageURL", user.getProfileBackgroundImageURL())
            .put("ProfileBackgroundImageUrlHttps", user.getProfileBackgroundImageUrlHttps())
            .put("ProfileBannerURL", user.getProfileBannerURL())
            .put("ProfileBannerRetinaURL", user.getProfileBannerRetinaURL())
            .put("ProfileBannerIPadURL", user.getProfileBannerIPadURL())
            .put("ProfileBannerIPadRetinaURL", user.getProfileBannerIPadRetinaURL())
            .put("ProfileBannerMobileURL", user.getProfileBannerMobileURL())
            .put("ProfileBannerMobileRetinaURL", user.getProfileBannerMobileRetinaURL())
            .put("ProfileBackgroundTiled", user.isProfileBackgroundTiled()).put("Lang", user.getLang())
            .put("StatusesCount", user.getStatusesCount()).put("GeoEnabled", user.isGeoEnabled())
            .put("Verified", user.isVerified()).put("Translator", user.isTranslator())
            .put("ListedCount", user.getListedCount()).put("FollowRequestSent", user.isFollowRequestSent());

    List<String> withheldInCountries = new ArrayList<>();
    if (null != user.getWithheldInCountries()) {
        for (String s : user.getWithheldInCountries()) {
            withheldInCountries.add(s);/*  w  w w. j av  a 2s . co m*/
        }
    }
    struct.put("WithheldInCountries", withheldInCountries);

}

From source file:com.javielinux.infos.InfoUsers.java

License:Apache License

public InfoUsers(User user) {
    setId(user.getId());//from   w ww .  ja  va2 s. co  m
    setName(user.getScreenName());
    setFullname(user.getName());
    setCreated(user.getCreatedAt());
    setLocation(user.getLocation());
    if (user.getURL() != null)
        setUrl(user.getURL().toString());
    setFollowers(user.getFollowersCount());
    setFollowing(user.getFriendsCount());
    setTweets(user.getStatusesCount());
    setBio(user.getDescription());
    if (user.getStatus() != null)
        setTextTweet(user.getStatus().getText());
    setUrlAvatar(user.getProfileImageURL().toString());

    ArrayList<Entity> ents = DataFramework.getInstance().getEntityList("users",
            "service is null or service = \"twitter.com\"");

    for (Entity ent : ents) {
        friendly.put(ent.getString("name"), new Friend(ent.getString("name")));
    }

}

From source file:com.marpies.ane.twitter.utils.UserUtils.java

License:Apache License

public static JSONObject getJSON(User user) throws JSONException {
    JSONObject userJSON = new JSONObject();
    userJSON.put("id", user.getId());
    userJSON.put("screenName", user.getScreenName());
    userJSON.put("name", user.getName());
    userJSON.put("createdAt", user.getCreatedAt());
    userJSON.put("description", user.getDescription());
    userJSON.put("tweetsCount", user.getStatusesCount());
    userJSON.put("likesCount", user.getFavouritesCount());
    userJSON.put("followersCount", user.getFollowersCount());
    userJSON.put("friendsCount", user.getFriendsCount());
    userJSON.put("profileImageURL", user.getProfileImageURL());
    userJSON.put("isProtected", user.isProtected());
    userJSON.put("isVerified", user.isVerified());
    userJSON.put("location", user.getLocation());
    return userJSON;
}

From source file:com.raythos.sentilexo.twitter.domain.QueryResultItemMapper.java

License:Apache License

public static TwitterQueryResultItemAvro mapItem(String queryOwner, String queryName, String queryString,
        Status status) {/*from  www.  ja va 2s  . co  m*/
    TwitterQueryResultItemAvro result = new TwitterQueryResultItemAvro();

    if (queryName != null)
        queryName = queryName.toLowerCase();
    if (queryOwner != null)
        queryOwner = queryOwner.toLowerCase();

    result.setQueryName(queryName);
    result.setQueryOwner(queryOwner);
    result.setQuery(queryString);
    result.setStatusId(status.getId());
    result.setText(status.getText());

    result.setRelevantQueryTerms(TwitterUtils.relevantQueryTermsFromStatus(queryString, status));
    result.setLang(status.getLang());

    result.setCreatedAt(status.getCreatedAt().getTime());

    User user = status.getUser();
    result.setUserId(user.getId());
    result.setScreenName(user.getScreenName());
    result.setUserLocation(user.getLocation());
    result.setUserName(user.getName());
    result.setUserDescription(user.getDescription());
    result.setUserIsProtected(user.isProtected());
    result.setUserFollowersCount(user.getFollowersCount());
    result.setUserCreatedAt(user.getCreatedAt().getTime());
    result.setUserCreatedAtAsString(DateTimeUtils.getDateAsText(user.getCreatedAt()));
    result.setCreatedAtAsString(DateTimeUtils.getDateAsText(status.getCreatedAt()));
    result.setUserFriendsCount(user.getFriendsCount());
    result.setUserListedCount(user.getListedCount());
    result.setUserStatusesCount(user.getStatusesCount());
    result.setUserFavoritesCount(user.getFavouritesCount());

    result.setCurrentUserRetweetId(status.getCurrentUserRetweetId());

    result.setInReplyToScreenName(status.getInReplyToScreenName());
    result.setInReplyToStatusId(status.getInReplyToStatusId());
    result.setInReplyToUserId(status.getInReplyToUserId());

    if (status.getGeoLocation() != null) {
        result.setLatitude(status.getGeoLocation().getLatitude());
        result.setLongitude(status.getGeoLocation().getLongitude());
    }

    result.setSource(status.getSource());
    result.setTrucated(status.isTruncated());
    result.setPossiblySensitive(status.isPossiblySensitive());

    result.setRetweet(status.getRetweetedStatus() != null);
    if (result.getRetweet()) {
        result.setRetweetStatusId(status.getRetweetedStatus().getId());
        result.setRetweetedText(status.getRetweetedStatus().getText());
    }
    result.setRetweeted(status.isRetweeted());
    result.setRetweetCount(status.getRetweetCount());
    result.setRetweetedByMe(status.isRetweetedByMe());

    result.setFavoriteCount(status.getFavoriteCount());
    result.setFavourited(status.isFavorited());

    if (status.getPlace() != null) {
        result.setPlace(status.getPlace().getFullName());
    }

    Scopes scopesObj = status.getScopes();
    if (scopesObj != null) {
        List scopes = Arrays.asList(scopesObj.getPlaceIds());
        result.setScopes(scopes);
    }
    return result;
}

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]));
    }/* ww w .j av  a 2s. 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  www  .  j a v  a2 s  .c om
 *
 * @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.vanita5.twittnuker.loader.support.RetweetsOfMeLoader.java

License:Open Source License

@Override
protected ResponseList<Status> getStatuses(final Twitter twitter, final Paging paging) throws TwitterException {
    if (twitter == null)
        return null;
    final ResponseList<Status> statuses = twitter.getRetweetsOfMe(paging);
    if (mTotalItemsCount == -1 && !statuses.isEmpty()) {
        final User user = statuses.get(0).getUser();
        if (user != null) {
            mTotalItemsCount = user.getStatusesCount();
        }/*from ww w. j a  v  a2  s.c om*/
    }
    return statuses;
}

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();//w ww  .j  a  va  2 s .  com
    created_at = getTime(user.getCreatedAt());
    is_protected = user.isProtected();
    is_verified = user.isVerified();
    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);
}