Search in sources :

Example 1 with Friendship

use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.

the class FriendDB method addCacheData.

@Override
public void addCacheData(Setting action, Params params, IResult responseObj) {
    boolean save = true;
    if (params.containsKey("uid")) {
        save = params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr());
    } else if (params.containsKey("screen_name")) {
        save = params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name());
    }
    if (save) {
        Friendship users = (Friendship) responseObj;
        if (users.getUsers().size() > 0) {
            if (params.containsKey("cursor") && Integer.parseInt(params.getParameter("cursor")) == 0) {
                CacheTimeUtils.saveTime("Friends", AppContext.getAccount().getUser());
                clear();
            }
            insertFriends(users.getUsers());
            ActivityHelper.putIntShareData(GlobalContext.getInstance(), "Friends" + AppContext.getAccount().getUser().getIdstr(), users.getNext_cursor());
        }
    }
}
Also used : Friendship(org.aisen.weibo.sina.sinasdk.bean.Friendship)

Example 2 with Friendship

use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.

the class FriendDB method findCacheData.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public IResult findCacheData(Setting action, Params params) {
    if (params.containsKey("uid")) {
        if (!params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr()))
            return null;
    } else if (params.containsKey("screen_name")) {
        if (!params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name()))
            return null;
    }
    List<WeiBoUser> userList = selectAll();
    if (userList.size() > 0) {
        Friendship users = new Friendship();
        users.setUsers(userList);
        users.setFromCache(true);
        users.setOutofdate(CacheTimeUtils.isOutofdate("Friends", AppContext.getAccount().getUser()));
        users.setNext_cursor(ActivityHelper.getIntShareData(GlobalContext.getInstance(), "Friends" + AppContext.getAccount().getUser().getIdstr(), 0));
        return users;
    }
    return null;
}
Also used : Friendship(org.aisen.weibo.sina.sinasdk.bean.Friendship) WeiBoUser(org.aisen.weibo.sina.sinasdk.bean.WeiBoUser)

Example 3 with Friendship

use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.

the class BilateralDB method addCacheData.

@Override
public void addCacheData(Setting action, Params params, IResult responseObj) {
    boolean save = true;
    if (params.containsKey("uid")) {
        save = params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr());
    } else if (params.containsKey("screen_name")) {
        save = params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name());
    }
    if (save) {
        Friendship users = (Friendship) responseObj;
        if (users.getUsers().size() > 0) {
            if (params.containsKey("cursor") && Integer.parseInt(params.getParameter("cursor")) == 0) {
                CacheTimeUtils.saveTime("Bilateral", AppContext.getAccount().getUser());
                clear();
            }
            insertFriends(users.getUsers());
            ActivityHelper.putIntShareData(GlobalContext.getInstance(), "Bilateral" + AppContext.getAccount().getUser().getIdstr(), users.getNext_cursor());
        }
    }
}
Also used : Friendship(org.aisen.weibo.sina.sinasdk.bean.Friendship)

Example 4 with Friendship

use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.

the class BilateralDB method findCacheData.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public IResult findCacheData(Setting action, Params params) {
    List<WeiBoUser> userList = selectAll();
    if (userList.size() > 0) {
        Friendship users = new Friendship();
        users.setUsers(userList);
        users.setFromCache(true);
        users.setOutofdate(CacheTimeUtils.isOutofdate("Bilateral", AppContext.getAccount().getUser()));
        users.setNext_cursor(ActivityHelper.getIntShareData(GlobalContext.getInstance(), "Bilateral" + AppContext.getAccount().getUser().getIdstr(), 0));
        return users;
    }
    return null;
}
Also used : Friendship(org.aisen.weibo.sina.sinasdk.bean.Friendship) WeiBoUser(org.aisen.weibo.sina.sinasdk.bean.WeiBoUser)

Example 5 with Friendship

use of org.aisen.weibo.sina.sinasdk.bean.Friendship in project AisenWeiBo by wangdan.

the class FollowersDB method addCacheData.

@Override
public void addCacheData(Setting action, Params params, IResult responseObj) {
    boolean save = true;
    if (params.containsKey("uid")) {
        save = params.getParameter("uid").equals(AppContext.getAccount().getUser().getIdstr());
    } else if (params.containsKey("screen_name")) {
        save = params.getParameter("screen_name").equals(AppContext.getAccount().getUser().getScreen_name());
    }
    if (save) {
        Friendship users = (Friendship) responseObj;
        if (users.getUsers().size() > 0) {
            if (params.containsKey("cursor") && Integer.parseInt(params.getParameter("cursor")) == 0) {
                CacheTimeUtils.saveTime("Followers", AppContext.getAccount().getUser());
                clear();
            }
            insertFriends(users.getUsers());
            ActivityHelper.putIntShareData(GlobalContext.getInstance(), "Followers" + AppContext.getAccount().getUser().getIdstr(), users.getNext_cursor());
        }
    }
}
Also used : Friendship(org.aisen.weibo.sina.sinasdk.bean.Friendship)

Aggregations

Friendship (org.aisen.weibo.sina.sinasdk.bean.Friendship)6 WeiBoUser (org.aisen.weibo.sina.sinasdk.bean.WeiBoUser)3