Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Cursor


    final String token = (String) control.getProperty(GbControl.AUTH_SUB_TOKEN);
    final GbSpreadsheetService gss = new GbSpreadsheetService(token);
    logger.info("Dump:kind=" + kind + ":rowNum=" + rowNum);

    // Prepare table only at first chain.
    final Cursor cursor = (_cursor == null) ? null : Cursor.fromWebSafeString(_cursor);
    if (cursor == null) {
      List<GbProperty> properties = GbDatastoreService.getProperties(kind);
      tableId = gss.prepareWorksheet(ssKey, kind, properties);
    }
View Full Code Here


    assert it.hasNext();
    Trivial t1 = it.next();
    assert t1.getId().equals(triv1.getId());
    assert !it.hasNext();

    Cursor cursor = it.getCursor();
    assert cursor != null;

    it = q.startAt(cursor).limit(1).iterator();

    assert it.hasNext();
View Full Code Here

    QueryResultIterator<Entity> it = pq.asQueryResultIterable().iterator();
    it.next();
    it.next();
    assert !it.hasNext();

    Cursor cursor = it.getCursor();
    assert cursor != null;

    QueryResultIterator<Entity> it2 = pq.asQueryResultIterable(FetchOptions.Builder.withStartCursor(cursor)).iterator();
    assert !it2.hasNext();

    Cursor cursor2 = it2.getCursor();
    assert cursor2 != null;

    QueryResultIterator<Entity> it3 = pq.asQueryResultIterable(FetchOptions.Builder.withStartCursor(cursor2)).iterator();
    assert !it3.hasNext();
    assert it3.getCursor() != null;
View Full Code Here

    it.next();
    it.next();
    assert !it.hasNext();

    // We should be at end
    Cursor cursor = it.getCursor();
    assert cursor != null;
    it = q.startAt(cursor).iterator();
    assert !it.hasNext();

    // Try that again just to be sure
View Full Code Here

  @Test
  public void cursorReverses() throws Exception {
    Query<Trivial> q = ofy().load().type(Trivial.class).order("__key__");
    QueryResultIterator<Trivial> it = q.iterator();

    @SuppressWarnings("unused")
    Cursor cursor0 = it.getCursor();
    final Trivial item1 = it.next();

    Cursor cursor1 = it.getCursor();
    final Trivial item2 = it.next();
    assert !it.hasNext();

    Cursor cursor2 = it.getCursor();
    Cursor cursor2Rev = it.getCursor().reverse();

    it = q.reverse().startAt(cursor2Rev).iterator();

    final Trivial item2Rev = it.next();
View Full Code Here

            .setKeysOnly();

        PreparedQuery preparedQuery = service.prepare(query);
        QueryResultIterator<Entity> iter = preparedQuery.asQueryResultIterator();
        Assert.assertNotNull(iter.next());
        Cursor cursor = iter.getCursor();

        iter = service.prepare(query).asQueryResultIterator(FetchOptions.Builder.withStartCursor(cursor));
        Assert.assertFalse(iter.hasNext());
    }
View Full Code Here

    }

    @Test
    public void testStartCursor() {
        QueryResultList<Entity> results = executeQuery(withLimit(3));
        Cursor cursor = results.getCursor();    // points to foo4

        results = executeQuery(withStartCursor(cursor));
        assertEquals(asList(foo4, foo5), results);
    }
View Full Code Here

    }

    @Test
    public void testStartCursorAndLimit() {
        QueryResultList<Entity> results = executeQuery(withLimit(3));
        Cursor cursor = results.getCursor();    // points to foo4

        results = executeQuery(withStartCursor(cursor).limit(1));
        assertEquals(asList(foo4), results);
    }
View Full Code Here

    }

    @Test
    public void testStartCursorAndOffset() {
        QueryResultList<Entity> results = executeQuery(withLimit(3));
        Cursor cursor = results.getCursor();    // points to foo4

        results = executeQuery(withStartCursor(cursor).offset(1));
        assertEquals(asList(foo5), results);
    }
View Full Code Here

    }

    @Test
    public void testEndCursor() {
        QueryResultList<Entity> results = executeQuery(withLimit(3));
        Cursor cursor = results.getCursor();    // points to foo4

        results = executeQuery(withEndCursor(cursor));
        assertEquals(asList(foo1, foo2, foo3), results);
    }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Cursor

Copyright © 2018 www.massapicom. 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.