Examples of startCursor()


Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

    }
    if (cursor != null) {
      if (opts == null) {
        opts = withStartCursor(cursor);
      } else {
        opts.startCursor(cursor);
      }
    }

    // Use the fetch size of the fetch plan to determine chunk size.
    FetchPlan fetchPlan = query.getFetchPlan();
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

  private FetchOptions cloneFetchOptions(FetchOptions fetchOptions) {
    checkNotNull(fetchOptions);
    FetchOptions clonedOptions = cloneFetchOptionsPrefetchAndChunkSize(fetchOptions);
    Cursor startCursor = fetchOptions.getStartCursor();
    if (startCursor != null) {
      clonedOptions.startCursor(startCursor);
    }
    Cursor endCursor = fetchOptions.getEndCursor();
    if (endCursor != null) {
      clonedOptions.endCursor(endCursor);
    }
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

  public void beginSlice() {
    Preconditions.checkState(iterator == null, "%s: Already initialized: %s", this, iterator);
    FetchOptions options = withChunkSize(BATCH_SIZE);
    if (cursor != null) {
      options.startCursor(cursor);
    }
    iterator = getDatastoreService().prepare(query).asQueryResultIterator(options);
  }

  @Override
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

  public ProcessData process(ProcessContext context, ProcessData input) {
    // step 1 : read data
    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    FetchOptions fetchOptions = FetchOptions.Builder.withLimit(this.batchSize);
    if (!isNullOrEmpty(this.startCursor)) {
            fetchOptions.startCursor(Cursor.fromWebSafeString(this.startCursor));
        }
   
    // step 2 : convert data into evaluation result
    QueryResultList<Entity> entities = datastore.prepare(new Query(kind)).asQueryResultList(fetchOptions);
    this.startCursor = entities.getCursor().toWebSafeString()// update context
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

      return nextCursor;
    } else {
      // There may not be a baseCursor if we haven't iterated yet
      FetchOptions opts = FetchOptions.Builder.withDefaults();
      if (nextCursor != null)
        opts = opts.startCursor(nextCursor);

      return pq.asQueryResultIterator(opts.offset(nextOffset).limit(0)).getCursor();
    }
  }
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

   */
  private FetchOptions fetchOptions() {
    FetchOptions opts = FetchOptions.Builder.withDefaults();

    if (this.startAt != null)
      opts = opts.startCursor(this.startAt);

    if (this.endAt != null)
      opts = opts.endCursor(this.endAt);

    if (this.limit != 0)
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

        // fetch 1st page and get cursor1
        QueryResultList<Entity> nextBatch = service.prepare(query)
            .asQueryResultList(fetchOption);
        Cursor cursor1 = Cursor.fromWebSafeString(nextBatch.getCursor().toWebSafeString());
        // fetch 2nd page and get cursor2
        nextBatch = service.prepare(query).asQueryResultList(fetchOption.startCursor(cursor1));
        Cursor cursor2 = Cursor.fromWebSafeString(nextBatch.getCursor().toWebSafeString());
        // cursor1 as start and cursor2 as end and 15 in limit -- -- should return 2nd page.
        checkPage(query, cursor1, cursor2, limit, limit, testDat[1], testDat[1]);
        // cursor1 as start and cursor2 as end and 30 in limit -- should return 2nd page.
        checkPage(query, cursor1, cursor2, 2 * limit, limit, testDat[1], testDat[1]);
View Full Code Here

Examples of com.google.appengine.api.datastore.FetchOptions.startCursor()

    private Cursor checkPage(Query query, Cursor stCursor, Cursor endCursor, int limit, int exptRet,
                             String chkSt, String chkEnd) {
        FetchOptions fetchOption = FetchOptions.Builder.withLimit(limit);
        if (stCursor != null) {
            fetchOption = fetchOption.startCursor(stCursor);
        }
        if (endCursor != null) {
            fetchOption = fetchOption.endCursor(endCursor);
        }
        QueryResultList<Entity> nextBatch = service.prepare(query)
View Full Code Here

Examples of com.googlecode.objectify.Query.startCursor()

        Objectify objectify = ObjectifyService.begin();
        Query query = objectify.query(clazz).filter("dumpVersion", dumpVersion);
        if (bookmark != null) {
            logger.info("Proceeding query from bookmark: {}", bookmark);
            query.startCursor(Cursor.fromWebSafeString(bookmark));
        }

        QueryResultIterable queryResult = query.fetchKeys();
        QueryResultIterator iterator = queryResult.iterator();
        List<Key<?>> keysToFetch = new ArrayList<Key<?>>();
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.