Java Code Examples for com.google.appengine.api.datastore.Query#FilterOperator

The following examples show how to use com.google.appengine.api.datastore.Query#FilterOperator . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatastoreHelperTestBase.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
/**
 * inChk
 * - true: check if fDat are in result and if result count is correct;
 * - false: only check if result count is correct
 */
protected void verifyFilter(String kind, String pName, Object fDat,
                            Query.FilterOperator operator, int rCont, boolean inChk) {
    Query query = new Query(kind, rootKey);
    query.setFilter(new FilterPredicate(pName, operator, fDat));
    Object[] result = getResult(query, pName);
    assertEquals(rCont, result.length);
    if (inChk) {
        boolean find = false;
        for (Object data : result) {
            if (data.toString().equals(fDat.toString())) {
                find = true;
            }
        }
        assertEquals(true, find);
    }
}
 
Example 2
Source File: NamespaceTest.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
@Override
public void verifyFilter(String kind, String pName, Object fDat,
                         Query.FilterOperator operator, int rCont, boolean inChk) {
    Query query = new Query(kind);
    query.setFilter(new FilterPredicate(pName, operator, fDat));
    Object[] result = getResult(query, pName);
    assertEquals(rCont, result.length);
    if (inChk) {
        boolean find = false;
        for (Object data : result) {
            if (data.toString().equals(fDat.toString())) {
                find = true;
            }
        }
        assertEquals(true, find);
    }
}
 
Example 3
Source File: QueryTestBase.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
protected Query createQuery(Query.FilterOperator operator, Object value) {
    return createQuery(createFilter(operator, value));
}
 
Example 4
Source File: QueryTestBase.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
private Query.FilterPredicate createFilter(Query.FilterOperator operator, Object value) {
    return new Query.FilterPredicate(SINGLE_PROPERTY_NAME, operator, value);
}
 
Example 5
Source File: QueryTestBase.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
protected Set<Entity> whenFilteringBy(Query.FilterOperator operator, Object value) {
    return whenFilteringWith(createFilter(operator, value));
}
 
Example 6
Source File: QueryTestBase.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
protected Set<Entity> whenFilteringBy(Query.FilterOperator operator, Object value, Key parent) {
    return whenFilteringWith(createFilter(operator, value), parent);
}
 
Example 7
Source File: QueryTestBase.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
protected List<Entity> listReturnedWhenFilteringBy(Query.FilterOperator operator, Object value) {
    Query query = createQuery(operator, value);
    return service.prepare(query).asList(withDefaults());
}