Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.PreparedQuery.asList()


        NamespaceManager.set("two");
        Query query = new Query("kind").setFilter(new Query.FilterPredicate("someProperty", EQUAL, keyInNamespaceOne));
        PreparedQuery preparedQuery = service.prepare(query);
        preparedQuery.asSingleEntity();    // should not throw IllegalArgumentException as in previous test
        preparedQuery.asIterator().hasNext();    // should not throw IllegalArgumentException as in previous test
        preparedQuery.asList(withDefaults()).size();    // should not throw IllegalArgumentException as in previous test
    }
}
View Full Code Here


            final Filter buildTypeFilter = new Query.FilterPredicate("buildTypeId", FilterOperator.EQUAL, buildTypeId);
            final Query query = new Query(TEST_REPORT).setFilter(buildTypeFilter).addSort("buildId", DESCENDING);

            final DatastoreService datastoreService = reports.getDatastoreService();
            final PreparedQuery preparedQuery = datastoreService.prepare(query);
            final List<Entity> entities = preparedQuery.asList(FetchOptions.Builder.withLimit(limit.or(DEFAULT_FETCH_LIMIT)));

            results = new ArrayList<>();
            for (Entity oneEntity : entities) {
                final TestReport report = from(oneEntity);
                results.add(report);
View Full Code Here

            Query query = new Query("Unindexed")
                .addSort("someProperty")
                .addSort("otherProperty");

            PreparedQuery preparedQuery = service.prepare(query);
            list = preparedQuery.asList(withDefaults());
        } catch (DatastoreNeedIndexException ex) {
            Assert.fail("DatastoreNeedIndexException thrown too early");
        }

        try {
View Full Code Here

        }
    }

    private void executeQuery(Query query) {
        PreparedQuery preparedQuery = service.prepare(query);
        List<Entity> list = preparedQuery.asList(withDefaults());
        list.size();    // only here is the query actually executed
    }
}
View Full Code Here

        debugSql( sql, params );

        PreparedQuery pq = prepare( query, false );

        try {
            List<Entity> result = pq.asList( getFetchOptions( offset, 1 ));

            return result.size() != 0 ? fetch( result.get( 0 )) : null;
        }
        catch (Exception e) {
            errorSql( e, sql, params );
View Full Code Here

                q.setKeysOnly();

                q.addFilter(PROPERTY_EXPIRES,
                        FilterOperator.LESS_THAN_OR_EQUAL, expire);
                PreparedQuery pq = ds.prepare(q);
                List<Entity> entities = pq.asList(Builder
                        .withLimit(CLEANUP_LIMIT));
                if (entities != null) {
                    getLogger()
                            .log(Level.INFO,
                                    "Vaadin cleanup deleting {0} expired Vaadin sessions.",
View Full Code Here

                Query q = new Query(APPENGINE_SESSION_KIND);
                q.setKeysOnly();
                q.addFilter(PROPERTY_APPENGINE_EXPIRES,
                        FilterOperator.LESS_THAN_OR_EQUAL, expire);
                PreparedQuery pq = ds.prepare(q);
                List<Entity> entities = pq.asList(Builder
                        .withLimit(CLEANUP_LIMIT));
                if (entities != null) {
                    getLogger()
                            .log(Level.INFO,
                                    "Vaadin cleanup deleting {0} expired appengine sessions.",
View Full Code Here

                .addFilter("when", FilterOperator.LESS_THAN, oldestPermitted)
                .setKeysOnly();

            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            PreparedQuery pq = ds.prepare(query);
            List<Entity> entities = pq.asList(FetchOptions.Builder.withChunkSize(CHUNK_SIZE));
            if (entities.isEmpty()) {
                break;
            }

            ds.delete(DatastoreUtil.extractKeys(entities));
View Full Code Here

                q.setKeysOnly();

                q.addFilter(PROPERTY_EXPIRES,
                        FilterOperator.LESS_THAN_OR_EQUAL, expire);
                PreparedQuery pq = ds.prepare(q);
                List<Entity> entities = pq.asList(Builder
                        .withLimit(CLEANUP_LIMIT));
                if (entities != null) {
                    getLogger()
                            .log(Level.INFO,
                                    "Vaadin cleanup deleting {0} expired Vaadin sessions.",
View Full Code Here

                Query q = new Query(APPENGINE_SESSION_KIND);
                q.setKeysOnly();
                q.addFilter(PROPERTY_APPENGINE_EXPIRES,
                        FilterOperator.LESS_THAN_OR_EQUAL, expire);
                PreparedQuery pq = ds.prepare(q);
                List<Entity> entities = pq.asList(Builder
                        .withLimit(CLEANUP_LIMIT));
                if (entities != null) {
                    getLogger()
                            .log(Level.INFO,
                                    "Vaadin cleanup deleting {0} expired appengine sessions.",
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.