Package com.google.appengine.api.datastore

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


              .getDatastore();
        Query query = new Query(kind);
        PreparedQuery results = datastore.prepare(query);
        int i = 0;
        boolean end = true;
        for (Entity entity : results.asIterable()) {
          datastore.delete(entity.getKey());
          i++;
        if (getBusiness().getSystemService()
            .getRequestCPUTimeSeconds() > 25) {
          addEntityRemoveTask(kind);
View Full Code Here


          query.addFilter("_expires", FilterOperator.LESS_THAN,
              System.currentTimeMillis());
          PreparedQuery results = datastore.prepare(query);
          int i = 0;
          boolean end = true;
          for (Entity session : results.asIterable()) {
            datastore.delete(session.getKey());
            i++;
          if (getBusiness().getSystemService()
              .getRequestCPUTimeSeconds() > 25) {
            addSessionCleanTask();
View Full Code Here

    getQueryCache().removeQueries(clazz);
    getDao().getDaoStat().incQueryCalls();
    PreparedQuery p = getDatastore().prepare(q);
    List<Key> keys = new ArrayList<Key>();
    int count = 0;
    for (Entity entity : p.asIterable(FetchOptions.Builder.withChunkSize(CHUNK_SIZE))) {
      keys.add(entity.getKey());
      // GAE Datastore one call delete limit
      if (count++ >= 499) {
        getDatastore().delete(keys);
        keys.clear();
View Full Code Here

  protected List<T> selectNotCache(Query query) {
    getDao().getDaoStat().incQueryCalls();
    PreparedQuery p = getDatastore().prepare(query);
    List<Entity> entities = new ArrayList<Entity>();
    for (Entity entity : p.asIterable(FetchOptions.Builder.withChunkSize(CHUNK_SIZE))) {
      entities.add(entity);
    }
    return createModels(entities);
  }
View Full Code Here

  protected int count(Query query) {
    getDao().getDaoStat().incQueryCalls();
    query.setKeysOnly();
    PreparedQuery p = getDatastore().prepare(query);
    int count = 0;
    for (Entity entity : p.asIterable(FetchOptions.Builder.withChunkSize(CHUNK_SIZE))) count++;
    return count;
  }

  @Override
  public int count() {
View Full Code Here

    q.addFilter(EMAIL_PROPERTY, FilterOperator.EQUAL, email);
    q.addFilter(DEPT_PROPERTY, FilterOperator.EQUAL, dept);
    q.addFilter(COURSE_PROPERTY, FilterOperator.EQUAL, course);
    q.addFilter(SECTION_PROPERTY, FilterOperator.EQUAL, section);
    PreparedQuery pq = datastore.prepare(q);
    Iterator<Entity> it = pq.asIterable().iterator();
    while(it.hasNext())
      datastore.delete(it.next().getKey());
   
  }
 
View Full Code Here

      Query query = new Query(kind);
      if ((searchFor != null) && (!"".equals(searchFor))) {
        query.addFilter(searchBy, Query.FilterOperator.EQUAL, searchFor);
      }
      PreparedQuery pq = datastore.prepare(query);
      return pq.asIterable();
    }

    public static Key persistEntity(Entity entity)
    {
      Key key = entity.getKey();
View Full Code Here

      Query query = new Query(kind);
      query.setAncestor(ancestor);
      query.addFilter("__key__", Query.FilterOperator.GREATER_THAN, ancestor);
      PreparedQuery pq = datastore.prepare(query);
      if ((limit == 0) && (offset == 0)) {
        return pq.asIterable();
      }
      return pq.asIterable(FetchOptions.Builder.withOffset(offset).limit(limit));
    }

    public static Key getKey(String kind, String name)
View Full Code Here

      query.addFilter("__key__", Query.FilterOperator.GREATER_THAN, ancestor);
      PreparedQuery pq = datastore.prepare(query);
      if ((limit == 0) && (offset == 0)) {
        return pq.asIterable();
      }
      return pq.asIterable(FetchOptions.Builder.withOffset(offset).limit(limit));
    }

    public static Key getKey(String kind, String name)
    {
      return KeyFactory.createKey(kind, name);
View Full Code Here

      Query q = new Query("Boleto");

      Map<String, Entity> mB = new HashMap<String, Entity>();
      PreparedQuery pq = ds.prepare(q);
      Iterable<Entity> it = pq.asIterable();
      for (Entity e : it)
        mB.put((String)e.getProperty("codigo"), e);

      System.out.println("RES : " + mB.size());
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.