use of com.amazonaws.services.dynamodbv2.model.ScanRequest in project cas by apereo.
the class DynamoDbTicketRegistryFacilitator method getAll.
/**
* Gets all.
*
* @return the all
*/
public Collection<Ticket> getAll() {
final Collection<Ticket> tickets = new ArrayList<>();
final Collection<TicketDefinition> metadata = this.ticketCatalog.findAll();
metadata.forEach(r -> {
final ScanRequest scan = new ScanRequest(r.getProperties().getStorageName());
LOGGER.debug("Scanning table with request [{}]", scan);
final ScanResult result = this.amazonDynamoDBClient.scan(scan);
LOGGER.debug("Scanned table with result [{}]", scan);
tickets.addAll(result.getItems().stream().map(this::deserializeTicket).collect(Collectors.toList()));
});
return tickets;
}
use of com.amazonaws.services.dynamodbv2.model.ScanRequest in project camel by apache.
the class ScanCommand method execute.
@Override
public void execute() {
ScanResult result = ddbClient.scan(new ScanRequest().withTableName(determineTableName()).withScanFilter(determineScanFilter()));
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());
tmp.put(DdbConstants.SCANNED_COUNT, result.getScannedCount());
addToResults(tmp);
}
use of com.amazonaws.services.dynamodbv2.model.ScanRequest in project camel by apache.
the class AmazonDDBClientMock method scan.
@SuppressWarnings("unchecked")
@Override
public ScanResult scan(ScanRequest scanRequest) {
this.scanRequest = scanRequest;
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 ScanResult().withConsumedCapacity(consumed).withCount(1).withItems(getAttributes()).withScannedCount(10).withLastEvaluatedKey(lastEvaluatedKey);
}
Aggregations