use of com.amazonaws.services.dynamodbv2.model.ScanResult in project cas by apereo.
the class DynamoDbServiceRegistryFacilitator method count.
/**
* Count long.
*
* @return the long
*/
public long count() {
final ScanRequest scan = new ScanRequest(dynamoDbProperties.getTableName());
LOGGER.debug("Scanning table with request [{}] to count items", scan);
final ScanResult result = this.amazonDynamoDBClient.scan(scan);
LOGGER.debug("Scanned table with result [{}]", scan);
return result.getCount();
}
use of com.amazonaws.services.dynamodbv2.model.ScanResult in project cas by apereo.
the class DynamoDbServiceRegistryFacilitator method getAll.
/**
* Gets all.
*
* @return the all
*/
public List<RegisteredService> getAll() {
final List<RegisteredService> services = new ArrayList<>();
final ScanRequest scan = new ScanRequest(dynamoDbProperties.getTableName());
LOGGER.debug("Scanning table with request [{}]", scan);
final ScanResult result = this.amazonDynamoDBClient.scan(scan);
LOGGER.debug("Scanned table with result [{}]", scan);
services.addAll(result.getItems().stream().map(this::deserializeServiceFromBinaryBlob).sorted((o1, o2) -> Integer.valueOf(o1.getEvaluationOrder()).compareTo(o2.getEvaluationOrder())).collect(Collectors.toList()));
return services;
}
use of com.amazonaws.services.dynamodbv2.model.ScanResult 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(DynamoDbTicketRegistryFacilitator::deserializeTicket).collect(Collectors.toList()));
});
return tickets;
}
Aggregations