Search in sources :

Example 1 with BatchGetItemResult

use of com.amazonaws.services.dynamodbv2.model.BatchGetItemResult in project camel by apache.

the class BatchGetItemsCommand method execute.

@Override
public void execute() {
    BatchGetItemResult result = ddbClient.batchGetItem(new BatchGetItemRequest().withRequestItems(determineBatchItems()));
    Map tmp = new HashMap<>();
    tmp.put(DdbConstants.BATCH_RESPONSE, result.getResponses());
    tmp.put(DdbConstants.UNPROCESSED_KEYS, result.getUnprocessedKeys());
    addToResults(tmp);
}
Also used : BatchGetItemRequest(com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest) BatchGetItemResult(com.amazonaws.services.dynamodbv2.model.BatchGetItemResult) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with BatchGetItemResult

use of com.amazonaws.services.dynamodbv2.model.BatchGetItemResult in project camel by apache.

the class AmazonDDBClientMock method batchGetItem.

@SuppressWarnings("unchecked")
@Override
public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) {
    this.batchGetItemRequest = batchGetItemRequest;
    Map<String, List<Map<String, AttributeValue>>> responseMap = new HashMap<String, List<Map<String, AttributeValue>>>();
    List<Map<String, AttributeValue>> p = new ArrayList<Map<String, AttributeValue>>();
    p.add(getAttributes());
    responseMap.put("DOMAIN1", p);
    Map<String, AttributeValue> keysMap = new HashMap<String, AttributeValue>();
    keysMap.put("1", new AttributeValue("UNPROCESSED_KEY"));
    Map<String, KeysAndAttributes> unprocessedKeys = new HashMap<String, KeysAndAttributes>();
    unprocessedKeys.put("DOMAIN1", new KeysAndAttributes().withKeys(keysMap));
    return new BatchGetItemResult().withResponses(responseMap).withUnprocessedKeys(unprocessedKeys);
}
Also used : AttributeValue(com.amazonaws.services.dynamodbv2.model.AttributeValue) BatchGetItemResult(com.amazonaws.services.dynamodbv2.model.BatchGetItemResult) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) KeysAndAttributes(com.amazonaws.services.dynamodbv2.model.KeysAndAttributes) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

BatchGetItemResult (com.amazonaws.services.dynamodbv2.model.BatchGetItemResult)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AttributeValue (com.amazonaws.services.dynamodbv2.model.AttributeValue)1 BatchGetItemRequest (com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest)1 KeysAndAttributes (com.amazonaws.services.dynamodbv2.model.KeysAndAttributes)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1