Example #1
0
 public List<Long> GetRelationIDs(RelationType relationType, String searchinfo, int mount) {
   switch (relationType) {
     case Friend:
       try {
         return Translate(fm.getFriendsIdsByUid(searchinfo, mount, 0));
       } catch (WeiboException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
         return new ArrayList<Long>();
       }
     case FriendsOnBilateral:
       try {
         return Translate(fm.getFriendsBilateralIds(searchinfo, mount, 0));
       } catch (WeiboException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
         return new ArrayList<Long>();
       }
     case Follows:
       try {
         return Translate(fm.getFollowersIdsById(searchinfo, mount, 0));
       } catch (WeiboException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
       break;
   }
   return new ArrayList<Long>();
 }
Example #2
0
  public List<UserData> GetRelations(RelationType relationType, String name, int mount) {
    ArrayList<UserData> userDatas = new ArrayList<UserData>();
    UserWapper users = null;

    int totalMount = mount, cursor = 0;
    int rate = 200;
    if (totalMount < 200) rate = totalMount;
    while (cursor < totalMount) {
      try {
        switch (relationType) {
          case Friend:
            users = fm.getFriendsByScreenName(name, rate, cursor);

            break;
          case Follows:
            users = fm.getFollowersByName(name, rate, cursor);

            break;
          case FriendsOnBilateral:
            users = fm.getFriendsBilateral(name, rate, cursor);

            break;
          default:
            break;
        }
        totalMount =
            (int) (totalMount > users.getTotalNumber() ? users.getTotalNumber() : totalMount);
        cursor = (int) users.getNextCursor();

      } catch (Exception e) {
        //		XLogSys.Instance().Error(e.toString());
      }

      for (User user : users.getUsers()) {
        userDatas.add(DataConverter.ConvertFrom(user));
      }
      if (cursor == 0) break;
    }

    return userDatas;
  }