use of com.google.appengine.api.datastore.Query.Filter in project java-docs-samples by GoogleCloudPlatform.
the class QueriesTest method queryRestrictions_compositeFilter_isInvalid.
@Test
public void queryRestrictions_compositeFilter_isInvalid() throws Exception {
long minBirthYear = 1940;
long maxHeight = 200;
// [START inequality_filters_one_property_invalid_example]
Filter birthYearMinFilter = new FilterPredicate("birthYear", FilterOperator.GREATER_THAN_OR_EQUAL, minBirthYear);
Filter heightMaxFilter = new FilterPredicate("height", FilterOperator.LESS_THAN_OR_EQUAL, maxHeight);
Filter invalidFilter = CompositeFilterOperator.and(birthYearMinFilter, heightMaxFilter);
Query q = new Query("Person").setFilter(invalidFilter);
// [END inequality_filters_one_property_invalid_example]
// Note: The local devserver behavior is different than the production
// version of Cloud Datastore, so there aren't any assertions we can make
// in this test. The query appears to work with the local test runner,
// but will fail in production.
}
use of com.google.appengine.api.datastore.Query.Filter in project Cached-Datastore by Emperorlou.
the class QueryHelper method getFilteredList_Keys.
public List<Key> getFilteredList_Keys(String kind, String fieldName, FilterOperator operator, Object equalToValue, String fieldName2, FilterOperator operator2, Object equalToValue2) {
FilterPredicate f1 = new FilterPredicate(fieldName, operator, equalToValue);
FilterPredicate f2 = new FilterPredicate(fieldName2, operator2, equalToValue2);
Filter filter = CompositeFilterOperator.and(f1, f2);
return ds.fetchAsList_Keys(kind, filter, 1000);
}
use of com.google.appengine.api.datastore.Query.Filter in project Cached-Datastore by Emperorlou.
the class QueryHelper method getFilteredList_Count.
public Long getFilteredList_Count(String kind, Integer limit, String fieldName, FilterOperator operator, Object equalToValue, String fieldName2, FilterOperator operator2, Object equalToValue2, String fieldName3, FilterOperator operator3, Object equalToValue3) {
Query q = new Query(kind);
FilterPredicate f1 = new FilterPredicate(fieldName, operator, equalToValue);
FilterPredicate f2 = new FilterPredicate(fieldName2, operator2, equalToValue2);
FilterPredicate f3 = new FilterPredicate(fieldName3, operator3, equalToValue3);
Filter f = CompositeFilterOperator.and(f1, f2, f3);
q.setFilter(f);
return ds.countEntities(q, 5000);
}
use of com.google.appengine.api.datastore.Query.Filter in project Cached-Datastore by Emperorlou.
the class QueryHelper method getFilteredList.
public List<CachedEntity> getFilteredList(String kind, String fieldName, Object equalToValue, String fieldName2, Object equalToValue2) {
FilterPredicate f1 = new FilterPredicate(fieldName, FilterOperator.EQUAL, equalToValue);
FilterPredicate f2 = new FilterPredicate(fieldName2, FilterOperator.EQUAL, equalToValue2);
Filter filter = CompositeFilterOperator.and(f1, f2);
return ds.fetchAsList(kind, filter, 1000);
}
Aggregations