Example usage for twitter4j Twitter getUserLists

List of usage examples for twitter4j Twitter getUserLists

Introduction

In this page you can find the example usage for twitter4j Twitter getUserLists.

Prototype

ResponseList<UserList> getUserLists(String listOwnerScreenName, boolean reverse) throws TwitterException;

Source Link

Document

List the lists of the specified user.

Usage

From source file:com.dwdesign.tweetings.util.Utils.java

License:Open Source License

public static UserList findUserList(final Twitter twitter, final long user_id, final String list_name)
        throws TwitterException {
    if (twitter == null || user_id <= 0 || list_name == null)
        return null;
    final ResponseList<UserList> response = twitter.getUserLists(user_id, -1);
    for (final UserList list : response) {
        if (list_name.equals(list.getName()))
            return list;
    }//from w  w w .  ja v a 2  s .c  o  m
    return null;
}

From source file:com.dwdesign.tweetings.util.Utils.java

License:Open Source License

public static UserList findUserList(final Twitter twitter, final String screen_name, final String list_name)
        throws TwitterException {
    if (twitter == null || screen_name == null || list_name == null)
        return null;
    final ResponseList<UserList> response = twitter.getUserLists(screen_name, -1);
    for (final UserList list : response) {
        if (list_name.equals(list.getName()))
            return list;
    }/*from  w w w  .j av  a2 s .c o m*/
    return null;
}

From source file:org.examproject.tweet.service.SimpleTweetService.java

License:Apache License

private PagableResponseList<UserList> getUserList() {
    long cursol = -1;
    try {/*  w ww . j a  v a  2 s  .c o m*/
        Twitter twitter = getTwitter();
        return twitter.getUserLists(twitter.getScreenName(), cursol);
    } catch (TwitterException te) {
        throw new RuntimeException(te);
    }
}

From source file:org.examproject.tweet.service.SimpleTweetService.java

License:Apache License

private ResponseList<Status> getResponseList() {
    LOG.debug("called.");

    long cursol = -1;
    int listId = 0;
    int count = 50;
    int pageNumber = 1;

    Paging paging = new Paging(pageNumber, count);

    try {//from   w w w .ja v  a  2 s. c  om
        // TODO: polymorphism to here? -> plugin.

        // home
        if (paramValue.getResponseListMode().equals("home")) {
            Twitter twitter = getTwitter();
            return twitter.getHomeTimeline(paging);
        }

        // user
        if (paramValue.getResponseListMode().equals("user")) {
            Twitter twitter = getTwitter();
            return twitter.getUserTimeline(paging);
        }

        // list
        if (paramValue.getResponseListMode().equals("list")) {
            if (paramValue.getUserListName().length() != 0) {
                Twitter twitter = getTwitter();
                PagableResponseList<UserList> lists = twitter.getUserLists(twitter.getScreenName(), cursol);
                for (UserList list : lists) {
                    String listFullName = list.getFullName();
                    if (listFullName.equals(paramValue.getUserListName())) {
                        listId = list.getId();
                        return twitter.getUserListStatuses(listId, paging);
                    }
                }
            }
        }

        // default..
        Twitter twitter = getTwitter();
        return twitter.getHomeTimeline();

    } catch (TwitterException te) {
        // TODO: transition to an error page here?
        throw new RuntimeException(te);
    }
}

From source file:org.getlantern.firetweet.loader.support.UserListsLoader.java

License:Open Source License

@Override
public ResponseList<UserList> getUserLists(final Twitter twitter) throws TwitterException {
    if (twitter == null)
        return null;
    if (mUserId > 0)
        return twitter.getUserLists(mUserId, mReverse);
    else if (mScreenName != null)
        return twitter.getUserLists(mScreenName, mReverse);
    return null;/*w ww .java 2s . com*/
}