コード例 #1
0
  /** Make a new Query object that is exactly like the old. Too bad Query isn't Cloneable. */
  protected com.google.appengine.api.datastore.Query cloneRawQuery(
      com.google.appengine.api.datastore.Query orig) {
    com.google.appengine.api.datastore.Query copy =
        new com.google.appengine.api.datastore.Query(orig.getKind(), orig.getAncestor());

    for (FilterPredicate filter : orig.getFilterPredicates())
      copy.addFilter(filter.getPropertyName(), filter.getOperator(), filter.getValue());

    for (SortPredicate sort : orig.getSortPredicates())
      copy.addSort(sort.getPropertyName(), sort.getDirection());

    // This should be impossible but who knows what might happen in the future
    if (orig.isKeysOnly()) copy.setKeysOnly();

    return copy;
  }
コード例 #2
0
ファイル: QueryImpl.java プロジェクト: July-G/objectify
 /**
  * Get an iterator over the keys. Not part of the public api, but used by QueryKeysImpl. Assumes
  * that setKeysOnly() has already been set.
  */
 public QueryResultIterable<Key<T>> keysIterable() {
   assert actual.isKeysOnly();
   return loader.createQueryEngine().queryKeysOnly(this.getActualQuery(), this.fetchOptions());
 }