use of com.amazonaws.services.dynamodbv2.model.QueryRequest in project camel by apache.
the class QueryCommand method execute.
@Override
public void execute() {
QueryResult result = ddbClient.query(new QueryRequest().withTableName(determineTableName()).withAttributesToGet(determineAttributeNames()).withConsistentRead(determineConsistentRead()).withExclusiveStartKey(determineStartKey()).withKeyConditions(determineKeyConditions()).withExclusiveStartKey(determineStartKey()).withLimit(determineLimit()).withScanIndexForward(determineScanIndexForward()));
Map tmp = new HashMap<>();
tmp.put(DdbConstants.ITEMS, result.getItems());
tmp.put(DdbConstants.LAST_EVALUATED_KEY, result.getLastEvaluatedKey());
tmp.put(DdbConstants.CONSUMED_CAPACITY, result.getConsumedCapacity());
tmp.put(DdbConstants.COUNT, result.getCount());
addToResults(tmp);
}
use of com.amazonaws.services.dynamodbv2.model.QueryRequest in project camel by apache.
the class AmazonDDBClientMock method query.
@SuppressWarnings("unchecked")
@Override
public QueryResult query(QueryRequest queryRequest) {
this.queryRequest = queryRequest;
ConsumedCapacity consumed = new ConsumedCapacity();
consumed.setCapacityUnits(1.0);
Map<String, AttributeValue> lastEvaluatedKey = new HashMap<String, AttributeValue>();
lastEvaluatedKey.put("1", new AttributeValue("LAST_KEY"));
return new QueryResult().withConsumedCapacity(consumed).withCount(1).withItems(getAttributes()).withLastEvaluatedKey(lastEvaluatedKey);
}
Aggregations