Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.DatastoreService.prepare()


  public static Entity getStatistic(String id, String namespace) {
    NamespaceManager.set(namespace);
    DatastoreService dss = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query(STAT_KIND);
    q.addFilter(STAT_ID, FilterOperator.EQUAL, id);
    PreparedQuery pq = dss.prepare(q);
    if (pq.countEntities() == 1) {
      Entity e = pq.asSingleEntity();
      return e;
    } else {
      return null;
View Full Code Here


      String namespace) {
    NamespaceManager.set(namespace);
    DatastoreService dss = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query(TMP_OBJECT_KIND);
    q.addFilter(STAT_ID, FilterOperator.EQUAL, id);
    PreparedQuery pq = dss.prepare(q);
    if (pq.countEntities() == 1) {
      Entity e = pq.asSingleEntity();
      return e.getProperty(property);
    } else {
      return null;
View Full Code Here

      Object object, String namespace) {
    NamespaceManager.set(namespace);
    DatastoreService dss = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query(TMP_OBJECT_KIND);
    q.addFilter(STAT_ID, FilterOperator.EQUAL, id);
    PreparedQuery pq = dss.prepare(q);
    //System.out.println("if");
    if (pq.countEntities() == 1) {
      //System.out.println("EXIST");
      Entity e = pq.asSingleEntity();
      e.setProperty(property, object);
View Full Code Here

  private static void clearTmpData(String id, String namespace) {
    NamespaceManager.set(namespace);
    DatastoreService dss = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query(TMP_OBJECT_KIND);
    q.addFilter(STAT_ID, FilterOperator.EQUAL, id);
    PreparedQuery pq = dss.prepare(q);
    if (pq.countEntities() == 1) {
      Entity e = pq.asSingleEntity();
      // e.setProperty(STAT_FINISHED, true);
      // dss.put(e);
      dss.delete(e.getKey());
View Full Code Here

          .getDatastoreService();

      Query q = new Query(kind);
      q.setKeysOnly();
      FetchOptions fo = insertParametersToQueue(q);
      PreparedQuery pq = dss.prepare(q);
      limit = fo.getLimit();

      if (pq.countEntities() > 0) {
        try {
          List<Entity> arr = pq.asList(fo);
View Full Code Here

    public int count(String kind) throws NullPointerException {
        if (kind == null) {
            throw new NullPointerException("The kind parameter is null.");
        }
        DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
        return ds.prepare(new Query(kind)).countEntities(
            FetchOptions.Builder.withLimit(Integer.MAX_VALUE));
    }
}
View Full Code Here

    public int count(String kind) throws NullPointerException {
        if (kind == null) {
            throw new NullPointerException("The kind parameter is null.");
        }
        DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
        return ds.prepare(new Query(kind)).countEntities(
            FetchOptions.Builder.withLimit(Integer.MAX_VALUE));
    }
}
View Full Code Here

    public int count(String kind) throws NullPointerException {
        if (kind == null) {
            throw new NullPointerException("The kind parameter is null.");
        }
        DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
        return ds.prepare(new Query(kind)).countEntities(
            FetchOptions.Builder.withLimit(Integer.MAX_VALUE));
    }
}
View Full Code Here

    {
        Query query = new Query("User");
       
        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<User> ret = new ArrayList<User>();
        for(Entity e: results)
        {
            ret.add(new User(e));
View Full Code Here

            query.addFilter(tag + "Tag", Query.FilterOperator.EQUAL, true);
        }
       
        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

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.