/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public ScanRequest withAttributesToGet(java.util.Collection<String> attributesToGet) { setAttributesToGet(attributesToGet); return this; }
/** * @see ScanRequest#withAttributesToGet(String...) */ public ScanSpec withAttributesToGet(String ... attributes) { if (attributes == null) getRequest().setAttributesToGet(null); else getRequest().setAttributesToGet(Arrays.asList(attributes)); return this; }
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributesToGet(java.util.Collection)} or {@link #withAttributesToGet(java.util.Collection)} if you * want to override the existing values. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public ScanRequest withAttributesToGet(String... attributesToGet) { if (this.attributesToGet == null) { setAttributesToGet(new java.util.ArrayList<String>(attributesToGet.length)); } for (String ele : attributesToGet) { this.attributesToGet.add(ele); } return this; }
req.setAttributesToGet(fields); while (count < recordcount) { req.setExclusiveStartKey(startKey);
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> * instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param attributesToGet <p> * This is a legacy parameter. Use * <code>ProjectionExpression</code> instead. For more * information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer * Guide</i>. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public ScanRequest withAttributesToGet(java.util.Collection<String> attributesToGet) { setAttributesToGet(attributesToGet); return this; }
ScanRequest scanRequest = new ScanRequest(); scanRequest.setTableName(tableName); scanRequest.setAttributesToGet(attributesToGet); return scan(scanRequest);
ScanRequest scanRequest = new ScanRequest(); scanRequest.setTableName(tableName); scanRequest.setAttributesToGet(attributesToGet); scanRequest.setScanFilter(scanFilter); return scan(scanRequest);
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public ScanRequest withAttributesToGet(java.util.Collection<String> attributesToGet) { setAttributesToGet(attributesToGet); return this; }
/** * <p> * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setAttributesToGet(java.util.Collection)} or {@link #withAttributesToGet(java.util.Collection)} if you * want to override the existing values. * </p> * * @param attributesToGet * This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a * href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html" * >AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>. * @return Returns a reference to this object so that method calls can be chained together. */ public ScanRequest withAttributesToGet(String... attributesToGet) { if (this.attributesToGet == null) { setAttributesToGet(new java.util.ArrayList<String>(attributesToGet.length)); } for (String ele : attributesToGet) { this.attributesToGet.add(ele); } return this; }
/** * @see ScanRequest#withAttributesToGet(String...) */ public ScanSpec withAttributesToGet(String ... attributes) { if (attributes == null) getRequest().setAttributesToGet(null); else getRequest().setAttributesToGet(Arrays.asList(attributes)); return this; }
@Override protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows) { final List<String> attributeNames = columns.stream().map(col-> col.getName()).collect(Collectors.toList()); final ScanRequest scanRequest = new ScanRequest(table.getName()); scanRequest.setAttributesToGet(attributeNames); if (maxRows > 0) { scanRequest.setLimit(maxRows); } final ScanResult result = _dynamoDb.scan(scanRequest); return new DynamoDbDataSet(columns, result); }
Timer t = new Timer(); ScanRequest scanRequest = new ScanRequest(getTenant().getName()); scanRequest.setAttributesToGet(Arrays.asList("key")); // attributes to get
@Override public List<String> getRows(String storeName, String continuationToken, int count) { String tableName = storeToTableName(storeName); ScanRequest scanRequest = new ScanRequest(tableName); scanRequest.setAttributesToGet(Arrays.asList(ROW_KEY_ATTR_NAME)); // attributes to get if (continuationToken != null) { scanRequest.setExclusiveStartKey(makeDDBKey(continuationToken)); } List<String> rowKeys = new ArrayList<>(); while (rowKeys.size() < count) { ScanResult scanResult = scan(scanRequest); List<Map<String, AttributeValue>> itemList = scanResult.getItems(); if (itemList.size() == 0) { break; } for (Map<String, AttributeValue> attributeMap : itemList) { AttributeValue rowAttr = attributeMap.get(ROW_KEY_ATTR_NAME); rowKeys.add(rowAttr.getS()); if (rowKeys.size() >= count) { break; } } Map<String, AttributeValue> lastEvaluatedKey = scanResult.getLastEvaluatedKey(); if (lastEvaluatedKey == null) { break; } scanRequest.setExclusiveStartKey(lastEvaluatedKey); } return rowKeys; }
@Override public ScanResult scan(ScanRequest request) throws AmazonServiceException, AmazonClientException { Collection<String> attributesToGet = addSpecialAttributes(request.getAttributesToGet()); request.setAttributesToGet(attributesToGet); ScanResult result = txManager.getClient().scan(request); List<Map<String,AttributeValue>> items = handleItems(result.getItems(), request.getTableName(), request.getAttributesToGet()); result.setItems(items); return result; }