use of com.google.appengine.api.datastore.Query.FilterPredicate 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);
}
use of com.google.appengine.api.datastore.Query.FilterPredicate in project getting-started-java by GoogleCloudPlatform.
the class DatastoreSessionFilter method init.
@Override
public void init(FilterConfig config) throws ServletException {
// initialize local copy of datastore session variables
datastore = DatastoreServiceFactory.getDatastoreService();
// Delete all sessions unmodified for over two days
DateTime dt = DateTime.now(DateTimeZone.UTC);
Query query = new Query(SESSION_KIND).setFilter(new FilterPredicate("lastModified", FilterOperator.LESS_THAN_OR_EQUAL, dt.minusDays(2).toString(DTF)));
Iterator<Entity> results = datastore.prepare(query).asIterator();
while (results.hasNext()) {
Entity stateEntity = results.next();
datastore.delete(stateEntity.getKey());
}
}
use of com.google.appengine.api.datastore.Query.FilterPredicate in project codeu-2018-team12 by codeu-2018-team12.
the class PersistentDataStore method setUpUserEntity.
/**
* Retrieves a User Entity object
*
* @param user user in application
* @return User Entity
*/
private Entity setUpUserEntity(User user) {
Query query = new Query("chat-users").setFilter(new FilterPredicate("uuid", FilterOperator.EQUAL, user.getId().toString()));
PreparedQuery preparedQuery = datastore.prepare(query);
return preparedQuery.asSingleEntity();
}
Aggregations