Package com.google.appengine.api.datastore.Query

Examples of com.google.appengine.api.datastore.Query.Filter


      }
    }
  }

  private static Entity findDeviceByRegId(String regId) {
    Filter filter =
        new FilterPredicate(DEVICE_REG_ID_PROPERTY, FilterOperator.EQUAL, regId);
    Query query = new Query(DEVICE_TYPE).setFilter(filter);
    PreparedQuery preparedQuery = datastore.prepare(query);
    List<Entity> entities = preparedQuery.asList(DEFAULT_FETCH_OPTIONS);
    Entity entity = null;
View Full Code Here


  @Override
  public Pair<? extends Iterable<JobRecord>, String> queryRootPipelines(String classFilter,
      String cursor, final int limit) {
    Query query = new Query(JobRecord.DATA_STORE_KIND);
    Filter filter = classFilter == null || classFilter.isEmpty() ? new FilterPredicate(
        ROOT_JOB_DISPLAY_NAME, GREATER_THAN, null)
        : new FilterPredicate(ROOT_JOB_DISPLAY_NAME, EQUAL, classFilter);
    query.setFilter(filter);
    final PreparedQuery preparedQuery = dataStore.prepare(query);
    final FetchOptions fetchOptions = FetchOptions.Builder.withDefaults();
View Full Code Here

    // you can also use name to get key, then use the key to delete the
    // entity from datastore directly
    // because name is also the entity's key
   
    // query
    Filter filter = new FilterPredicate(Contact.FIELD_ID_ID,
        FilterOperator.EQUAL, id);

    Query query = new Query(Contact.CONTACT_ENTITY_ID);
    query.setFilter(filter);
View Full Code Here

    }
  }

  @Override
  public List<NoteList> fetchNotesLists(String userId) throws DAOException {
    Filter userFilter = new FilterPredicate(PROPERTY_USERID, FilterOperator.EQUAL, userId);
    Query query = new Query(ENTITY_KIND_NOTESLIST).setFilter(userFilter);
    PreparedQuery pq = datastore.prepare(query);
   
    List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
    List<NoteList> notesLists = new ArrayList<NoteList>();
View Full Code Here

//        Note note = Transformer.entity2Note(eNote);
//        results.add(note);
//      }
//    }
   
    Filter searchFilterNote1 = new FilterPredicate(PROPERTY_NOTE, FilterOperator.GREATER_THAN_OR_EQUAL,search);
    Filter searchFilterNote2 = new FilterPredicate(PROPERTY_NOTE, FilterOperator.LESS_THAN, search + "\ufffd");
    Filter searchFilter1 = CompositeFilterOperator.and(searchFilterNote1,searchFilterNote2);
    Filter searchFilterSubject1 = new FilterPredicate(PROPERTY_SUBJECT, FilterOperator.GREATER_THAN_OR_EQUAL,search);
    Filter searchFilterSubject2 = new FilterPredicate(PROPERTY_SUBJECT, FilterOperator.LESS_THAN, search + "\ufffd");
    Filter userFilter = new FilterPredicate(PROPERTY_USERID, FilterOperator.EQUAL, userId);
    Filter searchFilter2 = CompositeFilterOperator.and(searchFilterSubject1,searchFilterSubject2);
    Filter searchFilter = CompositeFilterOperator.or(searchFilter1,searchFilter2);
    Filter queryFilter = CompositeFilterOperator.and(searchFilter,userFilter);
    Query q = new Query(ENTITY_KIND_NOTE).setFilter(queryFilter);
    PreparedQuery prepq = datastore.prepare(q);
    List<Entity> notes = prepq.asList(FetchOptions.Builder.withDefaults());
    List<Note> results = new ArrayList<Note>();
    for(Entity eNote : notes){
View Full Code Here

  }

  /** */
  @Test
  public void filterWithLowLevelFilterObject() throws Exception {
    Filter filter = FilterOperator.GREATER_THAN.of("someString", triv1.getSomeString());

    Iterator<Trivial> it = ofy().load().type(Trivial.class).filter(filter).iterator();

    Trivial t2 = it.next();
    assert !it.hasNext();
View Full Code Here

   
    Key dbKey = KeyFactory.createKey(db, userId);
    HashMap<String, HashMap<String, Object>> attributes = new HashMap<String, HashMap<String, Object>>();
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
   
    Filter idFilter = new FilterPredicate("id", FilterOperator.EQUAL, id);
    Query query = new Query(table, dbKey)
        .addSort("name", SortDirection.ASCENDING)
        .setFilter(idFilter);
   
    PreparedQuery pq = datastore.prepare(query);
View Full Code Here

  private static final Logger LOGGER = Logger.getLogger(ImageServlet.class
      .getName());

  public final static BlobKey getBlobKeyByFileName(final String fileName) {

    Filter nameFilter = new FilterPredicate("filename",
        FilterOperator.EQUAL, fileName);

    final Query query = new Query("__BlobInfo__").setFilter(nameFilter);

    query.addSort("creation", SortDirection.DESCENDING);
View Full Code Here

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException
  {
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    Query q = new Query("setting");
    Filter filter = new FilterPredicate("mention",Query.FilterOperator.EQUAL,true);
    q.setFilter(filter);
    PreparedQuery pq = datastore.prepare(q);
    for (Entity result : pq.asIterable())
    {
      Key key = result.getKey();
View Full Code Here

  }

  private String getActiveTables() {
    Step step = MiniProfiler.step("API.getActiveTables");
    try {
      Filter segmentFilter = new FilterPredicate("segment",
          FilterOperator.IN, ACTIVE_SEGMENTS);

      Query q = new Query("Table").setFilter(segmentFilter);
      DatastoreService datastore = DatastoreServiceFactory
          .getDatastoreService();
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Query.Filter

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.