Package com.google.appengine.api.datastore

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


            // This actually deletes only 1,000 users.  A scalable
            // solution would use task queues and query cursors to
            // iterate over and delete all entities.
            Query q = new Query("ChatUser").setKeysOnly();
            PreparedQuery pq = datastore.prepare(q);
            List<Entity> entityList = pq.asList(FetchOptions.Builder.withLimit(1000));
            List<Key> keyList = new ArrayList();
            for (Entity e : entityList) {
                keyList.add(e.getKey());
            }
            datastore.delete(keyList);
View Full Code Here


    if (pq.countEntities() > 0) {
      boolean thrown = false;
      Entity lst = null;
      int readed = -1;
      try {
        List<Entity> arr = pq.asList(fo);
        if (arr.size() > 0) {
          lst = arr.get(arr.size() - 1);
        } else {
          finish = true;
        }
View Full Code Here

      PreparedQuery pq = dss.prepare(q);
      limit = fo.getLimit();

      if (pq.countEntities() > 0) {
        try {
          List<Entity> arr = pq.asList(fo);
          total = arr.size();
          if (total > 0) {
            lst = arr.get(arr.size() - 1);
          } else {
            calculate_total_stage_ended = true;
View Full Code Here

     *
     * @return entities as list
     */
    public List<Entity> asEntityList() {
        PreparedQuery pq = prepareQuery();
        return pq.asList(fetchOptions);
    }

    /**
     * Returns entities as query result list.
     *
 
View Full Code Here

     *            the query
     * @return entities as list
     */
    protected List<Entity> asEntityList(Query qry) {
        PreparedQuery pq = txSet ? ds.prepare(tx, qry) : ds.prepare(qry);
        return pq.asList(fetchOptions);
    }

    /**
     * Returns entities as query result list.
     *
 
View Full Code Here

  public List<NoteList> fetchNotesLists(String userId) throws DAOException {
    Filter userFilter = new FilterPredicate(PROPERTY_USERID, FilterOperator.EQUAL, userId);
    Query query = new Query(ENTITY_KIND_NOTESLIST).setFilter(userFilter);
    PreparedQuery pq = datastore.prepare(query);
   
    List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
    List<NoteList> notesLists = new ArrayList<NoteList>();
    for(Entity e : entities){
      NoteList notesList = Transformer.entity2NotesList(e);
      notesLists.add(notesList);
    }
View Full Code Here

      NoteList notesList = Transformer.entity2NotesList(entity);
     
      Query query = new Query(ENTITY_KIND_NOTE).setAncestor(notesList.getKey());
      PreparedQuery pq = datastore.prepare(query);
     
      List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
      List<Note> notes = new ArrayList<Note>();
     
      for(Entity e : entities){
        Note note = Transformer.entity2Note(e);
        notes.add(note);
View Full Code Here

    Filter searchFilter2 = CompositeFilterOperator.and(searchFilterSubject1,searchFilterSubject2);
    Filter searchFilter = CompositeFilterOperator.or(searchFilter1,searchFilter2);
    Filter queryFilter = CompositeFilterOperator.and(searchFilter,userFilter);
    Query q = new Query(ENTITY_KIND_NOTE).setFilter(queryFilter);
    PreparedQuery prepq = datastore.prepare(q);
    List<Entity> notes = prepq.asList(FetchOptions.Builder.withDefaults());
    List<Note> results = new ArrayList<Note>();
    for(Entity eNote : notes){
      Note note = Transformer.entity2Note(eNote);
      results.add(note);
    }
View Full Code Here

        }
       
        query.addSort("rating", SortDirection.DESCENDING);
        DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
        PreparedQuery pq = ds.prepare(query);
        List<Entity> results = pq.asList(FetchOptions.Builder.withLimit(number).offset(offset));
        List<ImageItem> ret = new ArrayList<ImageItem>();
        for(Entity e: results)
        {
            ret.add(new ImageItem(e));
        }
View Full Code Here

    DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query("ImageItem");
    q.addSort("num_duels", SortDirection.ASCENDING);
    PreparedQuery pq = ds.prepare(q);
    List<Entity> duelingList = pq.asList(FetchOptions.Builder.withLimit(numNewItems));
   
   
    q = new Query("__Stat_Kind__");
    q.addFilter("kind_name", FilterOperator.EQUAL, "ImageItem");
    Entity summary = ds.prepare(q).asSingleEntity();
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.