Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.PreparedQuery.asIterable()


            query.setKeysOnly();

            DatastoreService ds = Get();
            PreparedQuery stmt = ds.prepare(query);

            return stmt.asIterable();
        }
    }
    /**
     * Memcache
     */
 
View Full Code Here


    Query q = new Query(STAT_KIND);
    q.setKeysOnly();
    q.addFilter(STAT_ID, FilterOperator.EQUAL, calcId);
    PreparedQuery pq = dss.prepare(q);
    Iterable<Entity> it = pq.asIterable();
    List<Key> kk = new ArrayList<Key>();
    for (Iterator<Entity> i = it.iterator(); i.hasNext();) {
      Entity tmp = i.next();
      kk.add(tmp.getKey());
    }
View Full Code Here

        prepare = DatastoreServiceFactory.getDatastoreService()
            .prepare(query);
        // System.out.println("EXTRACT Ents!!!!! count = "
        // + prepare.countEntities() + " isforStoring ="
        // + isForStoring);
        Iterator<Entity> results = (options == null ? prepare
            .asIterable() : prepare.asIterable(options)).iterator();

        int countEntities = prepare.countEntities();

        if (prepare.countEntities() < limit && orderBy != null
View Full Code Here

            .prepare(query);
        // System.out.println("EXTRACT Ents!!!!! count = "
        // + prepare.countEntities() + " isforStoring ="
        // + isForStoring);
        Iterator<Entity> results = (options == null ? prepare
            .asIterable() : prepare.asIterable(options)).iterator();

        int countEntities = prepare.countEntities();

        if (prepare.countEntities() < limit && orderBy != null
            && orderBy.length() > 0
View Full Code Here

            newNo = FetchOptions.Builder.withLimit(limit);
          }

          prepare = DatastoreServiceFactory.getDatastoreService()
              .prepare(qq);
          Iterator<Entity> iter2 = (newNo == null ? prepare
              .asIterable() : prepare.asIterable(newNo))
              .iterator();

          ArrayList<Entity> ress = new ArrayList<Entity>();
          while (iter1.hasNext()) {
View Full Code Here

          }

          prepare = DatastoreServiceFactory.getDatastoreService()
              .prepare(qq);
          Iterator<Entity> iter2 = (newNo == null ? prepare
              .asIterable() : prepare.asIterable(newNo))
              .iterator();

          ArrayList<Entity> ress = new ArrayList<Entity>();
          while (iter1.hasNext()) {
            ress.add(iter1.next());
View Full Code Here

     *
     * @return entities as {@link Iterable}
     */
    public Iterable<Entity> asIterableEntities() {
        PreparedQuery pq = prepareQuery();
        return pq.asIterable(fetchOptions);
    }

    /**
     * Returns entities as {@link Iterator}.
     *
 
View Full Code Here

     *
     * @return entities as {@link Iterable}
     */
    public Iterable<Entity> asIterableEntities() {
        PreparedQuery pq = txSet ? ds.prepare(tx, query) : ds.prepare(query);
        return pq.asIterable(fetchOptions);
    }

    /**
     * Returns entities as {@link Iterator}.
     *
 
View Full Code Here

    if (property != null) {
      query.setFilter(new FilterPredicate("property", FilterOperator.EQUAL, property));
    }
    query.setKeysOnly();
    PreparedQuery preparedQuery = DATASTORE.prepare(tx, query);
    return Iterables.transform(preparedQuery.asIterable(), ENTITY_TO_KEY);
  }

  public static void serializeToDatastoreProperty(
      Transaction tx, Entity entity, String property, Serializable o, CompressionType compression) {
    byte[] bytes = serializeToByteArray(o, false, compression);
View Full Code Here

  {
    Query q = new Query("NEWS");

    PreparedQuery pq = datastore.prepare(q);

    for (Entity result : pq.asIterable()) {
      String uuid = (String) result.getProperty("UUID");
      if(uuid.compareTo(guid)==0){
      String title = (String) result.getProperty("Title");
      String author= (String) result.getProperty("Author");
      String body = (String) result.getProperty("HTMLText");
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.