Examples of asIterable()


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

    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();
  }
 
  /**
   *
   * @param kind
View Full Code Here

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

    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();
  }

  /**
   * List the entities in JSON format
   *
 
View Full Code Here

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

   
    // only 9 contacts should have survived this
    assertEquals(9, pq.countEntities());
   
    // the deleted entity should not be retrieved because it should have been deleted.
    for (final Entity entity: pq.asIterable()) {
      assertFalse(ids.get(0) == entity.getKey().getId());
    }
   
    assertNull(reader.get("Contact", ids.get(0)));
  }
View Full Code Here

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

  // TODO only transmit required fields for listview - do not copy all fields into dto to save bandwidth
  @Override
  public ListQueryResult getAll(String kind, final int from, final int to) {
    final PreparedQuery pq = db.prepare(new Query(kind));
    return copy.entitiesToDtoArray(kind, pq.countEntities(withDefaults()), pq.asIterable(withLimit(to - from + 1).offset(from)), false);
  }

  private PreparedQuery getFiltered(final String kind, final String field, final FilterOperator operator, final Object value) {
    final Query nameQuery = new Query(kind);
    nameQuery.addFilter(field, operator, value);
View Full Code Here

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

  }

  @Override
  public ListQueryResult getAllAssignedTo(String kind, long assignedTo, int from, int to) {
    final PreparedQuery pq = getFiltered(kind, "assignedTo", FilterOperator.EQUAL, KeyFactory.createKey(Employee.class.getSimpleName(), assignedTo));
    return copy.entitiesToDtoArray(kind, pq.countEntities(withDefaults()), pq.asIterable(), false);
  }

  @Override
  public ListQueryResult getAllMarked(String kind, int from, int to) {
    final PreparedQuery pq = getFiltered(kind, "marked", FilterOperator.EQUAL, true);
View Full Code Here

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

  }

  @Override
  public ListQueryResult getAllMarked(String kind, int from, int to) {
    final PreparedQuery pq = getFiltered(kind, "marked", FilterOperator.EQUAL, true);
    return copy.entitiesToDtoArray(kind, pq.countEntities(withDefaults()), pq.asIterable(), false);
  }

  @Override
  public ListQueryResult search(String dtoIndex, Dto searchContact, int from, int to) {
    // TODO Auto-generated method stub
View Full Code Here

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

      for (final String fieldName : r.get(originating).get(related)) {
        // TODO use parallel fetch instead if possible
        final PreparedQuery pq = getFiltered(originating, fieldName, FilterOperator.EQUAL, keyOrigin);

        for (final Entity entity : pq.asIterable()) {
          // TODO should still indicate that nothing has to be resolved
          result.add(copy.entityToDto(originating, entity, false/*, false*/));
        }
      }
    }
 
View Full Code Here

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

  @Override
  public ListQueryResult getAllByNamePrefix(String kind, String prefix, int from, int to) {
    final ArrayList<Dto> hits = new ArrayList<Dto>();
    final PreparedQuery pq = getFiltered(kind, "name", FilterOperator.GREATER_THAN_OR_EQUAL, prefix);

    for (final Entity entity : pq.asIterable()) {
      if (null != entity.getProperty("name") && entity.getProperty("name") instanceof String && entity.getProperty("name").toString().startsWith(prefix)) {
        // TODO should still indicate that nothing has to be resolved
        hits.add(copy.entityToDto(kind, entity, false/*, false*/));
      }
    }
 
View Full Code Here

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

  public ListQueryResult getAll(String kind, String sortColumn, honeycrm.client.s.SortDirection sortDirection, int from, int to) {
    final Query q = new Query(kind);
    final SortDirection dir = sortDirection.equals(honeycrm.client.s.SortDirection.Ascending) ? SortDirection.ASCENDING : SortDirection.DESCENDING;
    q.addSort(sortColumn, dir);
    PreparedQuery pq = db.prepare(q);
    return copy.entitiesToDtoArray(kind, pq.countEntities(withDefaults()), pq.asIterable(withLimit(to - from + 1).offset(from)), false);
  }
}
View Full Code Here

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

  @Override
  public ArrayList<String> getPluginNames() {
    final ArrayList<String> list = new ArrayList<String>();
    final PreparedQuery q = db.prepare(new Query("Plugin"));
    for (final Entity e: q.asIterable()) {
      list.add(String.valueOf(e.getProperty("name")));
    }
    return list;
  }
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.