本文整理汇总了Java中com.google.appengine.api.datastore.Query.Filter方法的典型用法代码示例。如果您正苦于以下问题:Java Query.Filter方法的具体用法?Java Query.Filter怎么用?Java Query.Filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.Query
的用法示例。
在下文中一共展示了Query.Filter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeltaEntityIterator
import com.google.appengine.api.datastore.Query; //导入方法依赖的package包/类
private CheckedIterator getDeltaEntityIterator(long startVersion, @Nullable Long endVersion,
FetchOptions fetchOptions, boolean forward, boolean keysOnly)
throws PermanentFailure, RetryableFailure {
checkRange(startVersion, endVersion);
if (endVersion != null && startVersion == endVersion) {
return CheckedIterator.EMPTY;
}
Query.Filter filter = FilterOperator.GREATER_THAN_OR_EQUAL.of(Entity.KEY_RESERVED_PROPERTY,
makeDeltaKey(objectId, startVersion));
if (endVersion != null) {
filter = Query.CompositeFilterOperator.and(filter,
FilterOperator.LESS_THAN.of(Entity.KEY_RESERVED_PROPERTY,
makeDeltaKey(objectId, endVersion)));
}
Query q = new Query(deltaEntityKind)
.setAncestor(makeRootEntityKey(objectId))
.setFilter(filter)
.addSort(Entity.KEY_RESERVED_PROPERTY,
forward ? SortDirection.ASCENDING : SortDirection.DESCENDING);
if (keysOnly) {
q.setKeysOnly();
}
return tx.prepare(q).asIterator(fetchOptions);
}
示例2: getLastStatus
import com.google.appengine.api.datastore.Query; //导入方法依赖的package包/类
private ArrayList<Medicion> getLastStatus(int amountData) {
// Poner Key estacion + hora_muestra
Calendar calendarTwoAgo = Calendar.getInstance(TimeZone.getTimeZone("CET"));
calendarTwoAgo.add(Calendar.DATE, -3);
Date dateTwoAgo = calendarTwoAgo.getTime();
// Prepare
Query.Filter keyFilter = new Query.FilterPredicate(PROPERTY_MEASURE_DATE, Query.FilterOperator.GREATER_THAN, dateTwoAgo);
Query.Filter no2Filter = new Query.FilterPredicate(PROPERTY_COMPUESTO, Query.FilterOperator.EQUAL, NO2.name());
List<Query.Filter> filterList = new ArrayList<>();
filterList.add(keyFilter);
filterList.add(no2Filter);
Query.Filter filter = new Query.CompositeFilter(Query.CompositeFilterOperator.AND, filterList);
Query query = new Query(ENTITY_TYPE_MEDIDAS)
.setFilter(filter)
.addSort(PROPERTY_MEASURE_DATE
, Query.SortDirection.DESCENDING);
// Query
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
PreparedQuery pq = datastore.prepare(query);
// Get results
List<com.google.appengine.api.datastore.Entity> resultList = pq.asList(FetchOptions.Builder.withLimit(amountData));
ArrayList<Medicion> result = new ArrayList<>();
if (resultList.size()!=0) {
mLogger.info("Watching " + resultList.size() + " last values of ESTADO");
for (com.google.appengine.api.datastore.Entity item : resultList){
result.add(new Medicion((Date) item.getProperty(PROPERTY_MEASURE_DATE), (String) item.getProperty(PROPERTY_AVISO), (String) item.getProperty(PROPERTY_AVISO_STATE), (String) item.getProperty(PREPERTY_AVISO_MAX_TODAY), (String) item.getProperty(PROPERTY_ESCENARIO_STATE_TODAY), (String) item.getProperty(PROPERTY_ESCENARIO_STATE_TOMORROW), (String) item.getProperty(PROPERTY_ESCENARIO_STATE_TOMORROW_MANUAL) ,isPureMadrid()));
}
} else {
// No hay datos
mLogger.info("No previous values for ESTADO");
}
return result;
}
示例3: and
import com.google.appengine.api.datastore.Query; //导入方法依赖的package包/类
@Override
public Query.Filter and(AndCriteria andCriteria) {
List<Condition> conditions = andCriteria.conditions();
if (conditions.size() == 1) {
return toPredicate(conditions.get(0));
} else {
List<Query.Filter> filters = new ArrayList<>();
for (Condition condition : conditions) {
filters.add(toPredicate(condition));
}
return new Query.CompositeFilter(Query.CompositeFilterOperator.AND, filters);
}
}
示例4: or
import com.google.appengine.api.datastore.Query; //导入方法依赖的package包/类
@Override
public Query.Filter or(OrCriteria orCriteria) {
List<Query.Filter> filters = new ArrayList<>();
filters.add(convert(orCriteria.getLeft()));
filters.add(convert(orCriteria.getRight()));
return new Query.CompositeFilter(Query.CompositeFilterOperator.OR, filters);
}
示例5: convert
import com.google.appengine.api.datastore.Query; //导入方法依赖的package包/类
@Override
public Query.Filter convert(Criteria criteria) {
return criteria.apply(this);
}
示例6: toPredicate
import com.google.appengine.api.datastore.Query; //导入方法依赖的package包/类
private Query.Filter toPredicate(Condition condition) {
return new Query.FilterPredicate(condition.getProperty().getName(), convert(condition), condition.getValue());
}