Package com.google.appengine.api.datastore

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


    NamespaceManager.set(namespace);
    DatastoreService dss = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query(STAT_KIND);
    q.addFilter(STAT_ID, FilterOperator.EQUAL, key);
    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


    NamespaceManager.set(namespace);
    DatastoreService dss = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query(STAT_KIND);
    q.addFilter(STAT_ID, FilterOperator.EQUAL, key);
    PreparedQuery pq = dss.prepare(q);
    if (pq.countEntities() == 1) {
      Entity e = pq.asSingleEntity();
      e.setProperty(STAT_COUNTED, true);
      dss.put(e);
    }
  }
View Full Code Here

        // + prepare.countEntities() + " isforStoring ="
        // + isForStoring);
        Iterator<Entity> results = (options == null ? prepare
            .asIterable() : prepare.asIterable(options)).iterator();

        int countEntities = prepare.countEntities();

        if (prepare.countEntities() < limit && orderBy != null
            && orderBy.length() > 0
            && !orderBy.equals(Entity.KEY_RESERVED_PROPERTY)) {
          Query qq = new Query(kind);
View Full Code Here

    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

        Iterator<Entity> results = (options == null ? prepare
            .asIterable() : prepare.asIterable(options)).iterator();

        int countEntities = prepare.countEntities();

        if (prepare.countEntities() < limit && orderBy != null
            && orderBy.length() > 0
            && !orderBy.equals(Entity.KEY_RESERVED_PROPERTY)) {
          Query qq = new Query(kind);
          if (query.getAncestor() != null) {
            qq.setAncestor(query.getAncestor());
View Full Code Here

    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

    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);
      dss.put(e);
    }else if(pq.countEntities() == 0){
View Full Code Here

    if (pq.countEntities() == 1) {
      //System.out.println("EXIST");
      Entity e = pq.asSingleEntity();
      e.setProperty(property, object);
      dss.put(e);
    }else if(pq.countEntities() == 0){
      //System.out.println("DO NOT EXIST");
      Entity e = new Entity(TMP_OBJECT_KIND);
      e.setProperty(STAT_ID, id);
      e.setProperty(property, object);
      dss.put(e);
View Full Code Here

    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

      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);
          total = arr.size();
          if (total > 0) {
            lst = arr.get(arr.size() - 1);
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.