Exemplo n.º 1
0
 public <T, V> Query<T> find(
     String kind, Class<T> clazz, String property, V value, int offset, int size) {
   Query<T> query = find(kind, clazz);
   query.offset(offset);
   query.limit(size);
   return query.filter(property, value);
 }
Exemplo n.º 2
0
  public List<User> findWithLimitAndOffset(int limit, int offset, String sortField) {

    Query<User> findQuery = ds.createQuery(User.class);
    if (limit > 0) {
      findQuery = findQuery.limit(limit);
    }
    if (offset > 0) {
      findQuery = findQuery.offset(offset);
    }
    if (null != sortField) {
      findQuery = findQuery.order(sortField);
    }

    if (null == findQuery) {
      return null;
    }

    List<User> users = findQuery.asList();
    return (users.isEmpty()) ? null : users;
  }