Examples of FeedResult


Examples of com.skyline.feed.model.FeedResult

      for(Fan fan : fans){
        idolIds.add(fan.getIdolId());
        //System.out.println(fan.getIdolId());
      }
      //long t1=System.currentTimeMillis();
      FeedResult result = subscribedFeedService.getFeeds(idolIds, user.getId(), current, level);
      if (current == 0 && level == 0) {
        WebHelper.setSessionAttribute(request, Constant.SESSION_LAST_QUERY_TIME, (new Date()).getTime());
      }
      //long t2=System.currentTimeMillis();
      //System.out.println(t2-t1);
View Full Code Here

Examples of com.skyline.feed.model.FeedResult

    }
  }

  @Test
  public void testQuery(){
    FeedResult result=personalFeedService.getFeeds(Long.valueOf(6), 0, 0);
    System.out.println(result.getCurrent());
    System.out.println(result.getLevel());
    List<DBObject> datas=result.getData();
    for(DBObject data:datas){
      System.out.println(data);
    }
  }
View Full Code Here

Examples of com.skyline.feed.model.FeedResult

    }
   
    Long ownerId = Long.valueOf(5);
    Integer current = 0;
    Integer level = 0;
    FeedResult result = subscribedFeedService.getFeeds(idolIds, ownerId, current, level);
    long t2=System.currentTimeMillis();
    System.out.println("耗时"+(t2-t1));
    System.out.println("current:"+result.getCurrent());
    System.out.println("level:"+result.getLevel());
    List<DBObject> datas=result.getData();
    for(DBObject data:datas){
      System.out.println(data);
    }
  }
View Full Code Here

Examples of com.skyline.feed.model.FeedResult

  }

  @Override
  public FeedResult getFeeds(Long ownerId, Integer current, Integer level) {

    FeedResult result = new FeedResult();
    List<DBObject> resultData = new ArrayList<DBObject>();
    // 当返回推信数目小于MIN_PAGE_SIZE则会自动也去找下一级的personalFeed
    while (resultData.size() < MIN_PAGE_SIZE) {
      // 当找完了所有的personalFeed后,break;MAX_FEED_LEVEL表示最大的personalFeed的index;level
      // >= MAX_FEED_LEVEL意味找完了所有的personalFeed
      if (level > MAX_FEED_LEVEL) {
        break;
      }

      DBCursor cursor = personalFeedDao.queryFeeds(ownerId, current, level);

      // while(cursor.hasNext()){
      // resultData.add(cursor.next());
      // }
      List<DBObject> feeds = cursor.toArray();
      resultData.addAll(feeds);

      // 当返回推信数目小于MIN_PAGE_SIZE,则将currentPage置为0,并会自动也去找下一级的personalFeed
      if (resultData.size() < MIN_PAGE_SIZE) {
        current = 0;
        level = level + 1;
      } else {
        current = feeds.size();
      }
    }
    result.setCurrent(current);
    result.setData(resultData);
    result.setLevel(level);
    return result;
  }
View Full Code Here

Examples of com.skyline.feed.model.FeedResult

  @Override
  public FeedResult getFeeds(List<Long> idolIds, Long ownerId, Integer current, Integer level) {
    List<Long> idolIdsAction=idolIds;
    idolIdsAction.add(ownerId);
    FeedResult result = new FeedResult();
    List<DBObject> returnFeeds = this.getFeedsImpl(idolIdsAction, ownerId, current, level);
    current=current+returnFeeds.size();
    //当记录数依然少于最小分页时,说明在这个分库的数据已经找完了,应到下一级的分库中
    while (returnFeeds.size() < MIN_PAGE_SIZE) {
      if (level >= MAX_FEED_LEVEL) {
        //Tested
        break;
      } else {
        level = level + 1;
        current = 0;
        List<DBObject> feeds = this.getFeedsImpl(idolIdsAction, ownerId, current, level);
        returnFeeds.addAll(feeds);
        current = feeds.size();
      }
    }
    result.setCurrent(current);
    result.setData(returnFeeds);
    result.setLevel(level);
    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.