예제 #1
0
 public static Page<Official> page(
     int page, int pageSize, String sortBy, String order, String filter) {
   Query<Official> query = Ebean.find(Official.class);
   query.where().ilike("lastName", "%" + filter + "%");
   query.where().orderBy(sortBy + " " + order);
   Page<Official> p = query.findPagingList(pageSize).getPage(page);
   return p;
 }
 /** {@inheritDoc} */
 @Override
 @Transactional(readOnly = true)
 public PagingList<Session> find(
     User user, String name, String orderBy, boolean ascending, int pageSize) {
   // TODO union with sessions where the user has participated
   Query<Session> query = ebean.find(Session.class);
   ExpressionList<Session> expr = query.where().eq("author", user);
   if (!Strings.isNullOrEmpty(name)) {
     expr = expr.ilike("name", name);
   }
   query = ascending ? expr.orderBy().asc(orderBy) : expr.orderBy().desc(orderBy);
   return new EbeanPagingList<Session>(query.findPagingList(pageSize));
 }