List of usage examples for com.amazonaws.services.dynamodbv2.model KeysAndAttributes toString
@Override
public String toString()
From source file:com.vivastream.dynamodb.core.DynamoDBTemplate.java
License:Apache License
public <T> List<T> batchGet(String tableName, KeysAndAttributes keysAndAttributes, final ObjectExtractor<T> extractor) throws EmptyResultDataAccessException { Assert.notNull(tableName, "Table must not be null"); Assert.notNull(extractor, "ObjectExtractor must not be null"); if (logger.isDebugEnabled()) { logger.debug("Executing batch get on " + tableName + " for " + keysAndAttributes.toString()); }/*from ww w . j av a2s . c o m*/ List<T> results = new ArrayList<T>(keysAndAttributes.getKeys().size()); Map<String, KeysAndAttributes> unprocessedKeys = Collections.singletonMap(tableName, keysAndAttributes); while (unprocessedKeys.size() > 0) { BatchGetItemResult result = client.batchGetItem(unprocessedKeys); List<Map<String, AttributeValue>> items = result.getResponses().get(tableName); if (items != null) { for (Map<String, AttributeValue> item : items) { results.add(extractor.extract(item)); } } unprocessedKeys = result.getUnprocessedKeys(); } if (results.size() == 0) { throw new EmptyResultDataAccessException( "No results found in " + tableName + "for " + keysAndAttributes.toString()); } return results; }