Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.PreparedQuery


    ArrayList<Key> dataEntryKeys = new ArrayList<Key>();
    
    Query query = new Query("Patient", KeyFactory.createKey("User", email));
    query.setKeysOnly();
    // Submit the query
    PreparedQuery pq = datastore.prepare(query);
    for (Entity result : pq.asIterable()) {
      Key patients_key = result.getKey();
      Query data_query = new Query("DataEntry", patients_key);
      PreparedQuery dq = datastore.prepare(data_query);
      for (Entity de : dq.asIterable()) {
        dataEntryKeys.add(de.getKey());
      }
     }
    return dataEntryKeys;
  }
View Full Code Here


    logger.log(Level.INFO, "Search entities based on search criteria");
    Query q = new Query(kind);
    if (searchFor != null && !"".equals(searchFor)) {
      q.addFilter(searchBy, FilterOperator.EQUAL, searchFor);
    }
    PreparedQuery pq = datastore.prepare(q);
    return pq.asIterable();
  }
View Full Code Here

  public static Iterable<Entity> listChildren(String kind, Key ancestor) {
    logger.log(Level.INFO, "Search entities based on parent");
    Query q = new Query(kind);
    q.setAncestor(ancestor);
    q.addFilter(Entity.KEY_RESERVED_PROPERTY, FilterOperator.GREATER_THAN, ancestor);
    PreparedQuery pq = datastore.prepare(q);
    return pq.asIterable();
  }
View Full Code Here

  public static Iterable<Entity> listChildKeys(String kind, Key ancestor) {
    logger.log(Level.INFO, "Search entities based on parent");
    Query q = new Query(kind);
    q.setAncestor(ancestor).setKeysOnly();
    q.addFilter(Entity.KEY_RESERVED_PROPERTY, FilterOperator.GREATER_THAN, ancestor);
    PreparedQuery pq = datastore.prepare(q);
    return pq.asIterable();
  }
View Full Code Here

    filters.add(greater);
    filters.add(less);
    CompositeFilter comp = new CompositeFilter(CompositeFilterOperator.AND, filters);
    q.setFilter(comp);
   
    PreparedQuery pq = datastore.prepare(q);
    List<Entity> results = pq.asList(FetchOptions.Builder.withLimit(1));
    if (results.size() != 1 || !results.get(0).getProperty("name").toString().contains(backupName)) {
      System.err.println("BuiltinDatatoreToBigqueryIngesterTask: can't find backupName: " + backupName);
    }
    Entity result = results.get(0);
   
View Full Code Here

    assertNotNull(store.getPluginDescriptionEntity(new PluginDescription("foo", "bar")));
  }

  public void testCreatePluginAddsPluginDescriptionEntity() throws FileNotFoundException, IOException {
    store.createPlugin(new PluginDescription("foo", "wohoo"), new FileInputStream(FILE2));
    final PreparedQuery pq = db.prepare(new Query(PluginDescription.class.getSimpleName()));
    assertEquals(1, pq.countEntities());
  }
View Full Code Here

    assertEquals(1, pq.countEntities());
  }

  public void testCreatePluginAddsTwoBytecodeEntities() throws FileNotFoundException, IOException {
    store.createPlugin(new PluginDescription("foo", "wohoo"), new FileInputStream(FILE2));
    final PreparedQuery pq = db.prepare(new Query(PluginClassBytecode.class.getSimpleName()));
    assertEquals(2, pq.countEntities());
  }
View Full Code Here

    final Map<Key, Entity> entities = db.get(keys);

    assertEquals(COUNT, entities.size());

    final PreparedQuery pq = db.prepare(new Query(Contact.class.getSimpleName()));

    assertEquals(COUNT, pq.countEntities());

    assertTrue(entities.get(keys.get(0)) instanceof Serializable);
  }
View Full Code Here

    final Entity newKind = new Entity("NewKind");
    final Long value = 23L;
    newKind.setProperty("foo", value);
    db.put(newKind);

    final PreparedQuery pq = db.prepare(new Query("NewKind"));
    assertEquals(1, pq.countEntities());

    final Entity gotEntity = pq.asSingleEntity();
    assertEquals(newKind.getProperty("foo"), gotEntity.getProperty("foo"));
  }
View Full Code Here

    final Dto contact = new Dto("Contact");
    contact.set("name", "Foo");

    deletor.delete("Contact", creator.create(contact));

    final PreparedQuery pq = db.prepare(new Query("Contact"));
   
    assertEquals(0, pq.countEntities());
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.PreparedQuery

Copyright © 2018 www.massapicom. 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.