@Override public Integer getMaxResultSize() { return spec.getMaxResultSize(); }
@Override public boolean hasNextPage() { if (lastEvaluatedKey == null) return false; Integer max = spec.getMaxResultSize(); if (max == null) return true; return nextRequestLimit(max.intValue()) > 0; }
@Override public Page<Item,QueryOutcome> nextPage() { if (lastEvaluatedKey == null) { throw new NoSuchElementException("No more pages"); } final Integer max = spec.getMaxResultSize(); if (max != null) { int nextLimit = nextRequestLimit(max.intValue()); if (nextLimit == 0) throw new NoSuchElementException("No more pages"); request.setLimit(nextLimit); } request.setExclusiveStartKey(lastEvaluatedKey); QueryResult result = client.query(request); final int nextIndex = index + this.size(); return new QueryPage(client, spec, request, nextIndex, new QueryOutcome(result)); } }
public QueryPage( AmazonDynamoDB client, QuerySpec spec, QueryRequest request, int index, QueryOutcome outcome) { super(Collections.unmodifiableList( toItemList(outcome.getQueryResult().getItems())), outcome); this.client = client; this.spec = spec; this.request = request; this.index = index; final Integer max = spec.getMaxResultSize(); final QueryResult result = outcome.getQueryResult(); final List<?> ilist = result.getItems(); final int size = ilist == null ? 0 : ilist.size(); if (max != null && (index + size) > max) { this.lastEvaluatedKey = null; } else { this.lastEvaluatedKey = result.getLastEvaluatedKey(); } }
@Override public Page<Item, QueryOutcome> firstPage() { QueryRequest request = spec.getRequest(); request.setExclusiveStartKey(startKey); request.setLimit(InternalUtils.minimum( spec.getMaxResultSize(), spec.getMaxPageSize())); QueryResult result = client.query(request); QueryOutcome outcome = new QueryOutcome(result); setLastLowLevelResult(outcome); return new QueryPage(client, spec, request, 0, outcome); }
@Override public Integer getMaxResultSize() { return spec.getMaxResultSize(); }
@Override public boolean hasNextPage() { if (lastEvaluatedKey == null) return false; Integer max = spec.getMaxResultSize(); if (max == null) return true; return nextRequestLimit(max.intValue()) > 0; }
@Override public Page<Item,QueryOutcome> nextPage() { if (lastEvaluatedKey == null) { throw new NoSuchElementException("No more pages"); } final Integer max = spec.getMaxResultSize(); if (max != null) { int nextLimit = nextRequestLimit(max.intValue()); if (nextLimit == 0) throw new NoSuchElementException("No more pages"); request.setLimit(nextLimit); } request.setExclusiveStartKey(lastEvaluatedKey); QueryResult result = client.query(request); final int nextIndex = index + this.size(); return new QueryPage(client, spec, request, nextIndex, new QueryOutcome(result)); } }
public QueryPage( AmazonDynamoDB client, QuerySpec spec, QueryRequest request, int index, QueryOutcome outcome) { super(Collections.unmodifiableList( toItemList(outcome.getQueryResult().getItems())), outcome); this.client = client; this.spec = spec; this.request = request; this.index = index; final Integer max = spec.getMaxResultSize(); final QueryResult result = outcome.getQueryResult(); final List<?> ilist = result.getItems(); final int size = ilist == null ? 0 : ilist.size(); if (max != null && (index + size) > max) { this.lastEvaluatedKey = null; } else { this.lastEvaluatedKey = result.getLastEvaluatedKey(); } }
@Override public Page<Item, QueryOutcome> firstPage() { QueryRequest request = spec.getRequest(); request.setExclusiveStartKey(startKey); request.setLimit(InternalUtils.minimum( spec.getMaxResultSize(), spec.getMaxPageSize())); QueryResult result = client.query(request); QueryOutcome outcome = new QueryOutcome(result); setLastLowLevelResult(outcome); return new QueryPage(client, spec, request, 0, outcome); }