Package com.google.appengine.api.datastore

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


  public List<StoredSubscription> listSubscriptions() throws IOException {
    List<StoredSubscription> list = Lists.newArrayList();
    DatastoreService service = DatastoreServiceFactory.getDatastoreService();
    PreparedQuery results = service.prepare(new Query(KIND));

    for (Entity entity : results.asIterable()) {
      list.add(getSubscriptionFromEntity(entity));
    }

    return list;
  }
View Full Code Here


    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query("StormChannel");
    PreparedQuery pq = datastore.prepare(q);
    int num = pq.countEntities(FetchOptions.Builder.withDefaults());
    if(num > 0) {
      for(Entity ent : pq.asIterable()) {
        Key theKey = ent.getKey();
        if(ent.getProperty("scene").equals(this.scene)) {
          gameKey = KeyFactory.keyToString(theKey);
          break;
        }
View Full Code Here

    query.addFilter(PipelineModelObject.ROOT_JOB_KEY_PROPERTY, Query.FilterOperator.EQUAL,
        rootJobKey);
    PreparedQuery preparedQuery = dataStore.prepare(query);
    Iterable<Entity> returnValue;
    if (null != fetchOptions) {
      returnValue = preparedQuery.asIterable(fetchOptions);
    } else {
      returnValue = preparedQuery.asIterable();
    }
    return returnValue;
  }
View Full Code Here

    PreparedQuery preparedQuery = dataStore.prepare(query);
    Iterable<Entity> returnValue;
    if (null != fetchOptions) {
      returnValue = preparedQuery.asIterable(fetchOptions);
    } else {
      returnValue = preparedQuery.asIterable();
    }
    return returnValue;
  }

  private interface Instantiator<E extends PipelineModelObject> {
View Full Code Here

    query.setKeysOnly();
    ArrayList<Key> killList = new ArrayList<Key>();
    DatastoreService datastore = DatastoreServiceFactory
        .getDatastoreService();
    PreparedQuery pq = datastore.prepare(query);
    Iterable<Entity> entities = pq.asIterable(FetchOptions.Builder
        .withLimit(limit));

    log.warning("Starting old registration tokens clearing");

    try {
View Full Code Here

    query.setKeysOnly();
    ArrayList<Key> killList = new ArrayList<Key>();
    DatastoreService datastore = DatastoreServiceFactory
        .getDatastoreService();
    PreparedQuery pq = datastore.prepare(query);
    Iterable<Entity> entities = pq.asIterable(FetchOptions.Builder
        .withLimit(limit));

    log.warning("Starting old session clearing");

    try {
View Full Code Here

    keysToDelete.add(key);
    // Delete all children : both automatic ones (like collection indexes) and manual ones (object declared as children)
    Query toExecute = new Query(key);
    toExecute = toExecute.setKeysOnly();
    PreparedQuery prepared = datastore.prepare(toExecute);
    Iterable<Entity> result = prepared.asIterable();
    for(Entity e : result) {
      keysToDelete.add(e.getKey());
    }
    datastore.delete(keysToDelete);
    if (logger.isLoggable(Level.FINE)) {
View Full Code Here

   */
  @Override
  public Iterable<DataType> findAll() {
    Query used = new Query(getKind());
    PreparedQuery prepared = datastore.prepare(used);
    return new DataTypeIterable<DataType>(this, prepared.asIterable());
  }

  /**
   * Create an entity from the input object data. Notice that if the associated data class has defined a parent element,
   * we will first ensure this parent key exist in order to use it to create entity
View Full Code Here

  public EntityIterableWrap getEntityChildren( EntityWrap parent ) {
    Query q = new Query(KIND_NAME);
    String pid = (String)parent.entity.getProperty(ID_PROP);
    q.addFilter( PID_PROP, Query.FilterOperator.EQUAL, pid);
    PreparedQuery pq = this.datastore.prepare(q);
    return new EntityIterableWrap( pq.asIterable(), parent );
  }

  public EntityWrap getEntity( List<String> path, boolean autoinsert )
  { 
    EntityWrap current = null;
View Full Code Here

    }

    private EventEntry loadLastSnapshotEvent(String type, Object identifier) {
        Query query = EventEntry.forLastSnapshot("snapshot_" + type, identifier.toString());
        PreparedQuery preparedQuery = datastoreService.prepare(query);
        Iterator<Entity> entityIterator = preparedQuery.asIterable().iterator();
        if (entityIterator.hasNext()) {
            Entity lastSnapshot = entityIterator.next();
            return new EventEntry(lastSnapshot);
        }
        return null;
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.