示例#1
0
 public static List<Scenario> findInvolvingUserSearch(
     String searchTerm, String user, int pageSize, int pageNum) {
   PagingList<Scenario> pagingList =
       find.where()
           .eq("members.email", user)
           .icontains("name", searchTerm)
           .findPagingList(pageSize);
   Page<Scenario> page = pagingList.getPage(pageNum);
   return page.getList();
 }
示例#2
0
 public static List<Scenario> findToAccept(Date currentDate, int pageSize, int pageNum) {
   PagingList<Scenario> pagingList =
       find.where()
           .eq("isAccepted", false)
           .eq("isPublic", true)
           .or(
               com.avaje.ebean.Expr.lt("expirationDate", currentDate),
               com.avaje.ebean.Expr.isNull("expirationDate"))
           .findPagingList(pageSize);
   Page<Scenario> page = pagingList.getPage(pageNum);
   return page.getList();
 }
示例#3
0
 public static List<Scenario> findPublicAcceptedNotExpiredSearch(
     String searchTerm, Date currentDate, int pageSize, int pageNum) {
   PagingList<Scenario> pagingList =
       find.where()
           .eq("isPublic", true)
           .eq("isAccepted", true)
           .or(
               com.avaje.ebean.Expr.gt("expirationDate", currentDate),
               com.avaje.ebean.Expr.isNull("expirationDate"))
           .icontains("name", searchTerm)
           .findPagingList(pageSize);
   Page<Scenario> page = pagingList.getPage(pageNum);
   return page.getList();
 }
  @Test
  public void getUpVotedPostsSucceeds() {
    PostRatingDAO postRatingDAO = getInstance(PostRatingDAO.class);
    UserDAO userDAO = getInstance(UserDAO.class);
    PostDAO postDAO = getInstance(PostDAO.class);

    User user = userDAO.get("facebook::testuser");
    Page<Post> upVotedPosts = postRatingDAO.getUpVotedPosts(user, 0);
    assertThat(upVotedPosts.getList().size()).isEqualTo(0);

    Post post = postDAO.get(-11L);

    PostRatingPK key = new PostRatingPK(user.getKey(), post.getKey());
    PostRating pr = new PostRating();
    pr.setValue(1);
    pr.setKey(key);
    pr.setKey(key);
    postRatingDAO.create(pr);
    post.setRating(post.getRating() + 1);
    postRatingDAO.resetVotedPostKeyCache(user);

    upVotedPosts = postRatingDAO.getUpVotedPosts(user, 0);
    assertThat(upVotedPosts.getList().size()).isEqualTo(1);
  }
 public static List<Choco> rows(int rowId, int nbElemByRow) {
   Logger.debug("ChocoServices rows : " + find.all().size());
   Page<Choco> chocos = find.where().findPagingList(nbElemByRow).getPage(rowId);
   return chocos.getList();
 }
示例#6
0
 public static List<Scenario> findInvolvingUser(String user, int pageSize, int pageNum) {
   PagingList<Scenario> pagingList =
       find.where().eq("members.email", user).findPagingList(pageSize);
   Page<Scenario> page = pagingList.getPage(pageNum);
   return page.getList();
 }