com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest Java Examples

The following examples show how to use com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamoDBOperations.java    From geowave with Apache License 2.0 5 votes vote down vote up
private BatchGetItemResult getResults(
    final Map<String, KeysAndAttributes> requestItems,
    final short adapterId,
    final Map<ByteArray, GeoWaveRow> resultMap) {
  final BatchGetItemRequest request = new BatchGetItemRequest(requestItems);

  final BatchGetItemResult result = client.batchGetItem(request);
  result.getResponses().values().forEach(results -> results.stream().forEach(objMap -> {
    final byte[] dataId = objMap.get(DynamoDBRow.GW_PARTITION_ID_KEY).getB().array();
    final AttributeValue valueAttr = objMap.get(DynamoDBRow.GW_VALUE_KEY);
    final byte[] value = valueAttr == null ? null : valueAttr.getB().array();
    final AttributeValue visAttr = objMap.get(DynamoDBRow.GW_VISIBILITY_KEY);
    final byte[] vis = visAttr == null ? new byte[0] : visAttr.getB().array();
    resultMap.put(
        new ByteArray(dataId),
        DataIndexUtils.deserializeDataIndexRow(dataId, adapterId, value, vis));
  }));
  return result;
}
 
Example #2
Source File: TransactionManagerDBFacadeIntegrationTest.java    From dynamodb-transactions with Apache License 2.0 5 votes vote down vote up
private BatchGetItemRequest createBatchGetItemRequest(final boolean filterAttributes) {
    KeysAndAttributes keysAndAttributes = new KeysAndAttributes()
            .withKeys(key0);
    if (filterAttributes) {
        keysAndAttributes.withAttributesToGet(attributesToGet);
    }
    return new BatchGetItemRequest()
            .withRequestItems(
                    Collections.singletonMap(
                            INTEG_HASH_TABLE_NAME,
                            keysAndAttributes));
}
 
Example #3
Source File: TransactionManagerDBFacadeIntegrationTest.java    From dynamodb-transactions with Apache License 2.0 5 votes vote down vote up
private void testBatchGetItemsContainsItem(
        final TransactionManagerDynamoDBFacade facade,
        final Map<String, AttributeValue> item,
        final boolean filterAttributes) {
    BatchGetItemRequest batchGetItemRequest = createBatchGetItemRequest(filterAttributes);
    BatchGetItemResult batchGetItemResult = facade.batchGetItem(batchGetItemRequest);
    List<Map<String, AttributeValue>> items = batchGetItemResult.getResponses().get(INTEG_HASH_TABLE_NAME);
    assertEquals(1, items.size());
    assertContainsNoTransactionAttributes(items.get(0));
    assertEquals(item, items.get(0));
}
 
Example #4
Source File: TransactionManagerDBFacadeIntegrationTest.java    From dynamodb-transactions with Apache License 2.0 5 votes vote down vote up
private void testBatchGetItemsIsEmpty(final TransactionManagerDynamoDBFacade facade) {
    BatchGetItemRequest batchGetItemRequest = createBatchGetItemRequest(false);
    BatchGetItemResult batchGetItemResult = facade.batchGetItem(batchGetItemRequest);
    assertNotNull(batchGetItemResult.getResponses());
    assertEquals(1, batchGetItemResult.getResponses().size());
    assertNotNull(batchGetItemResult.getResponses().get(INTEG_HASH_TABLE_NAME));
    assertEquals(0, batchGetItemResult.getResponses().get(INTEG_HASH_TABLE_NAME).size());

}
 
Example #5
Source File: TransactionManagerDynamoDBFacade.java    From dynamodb-transactions with Apache License 2.0 5 votes vote down vote up
@Override
public BatchGetItemResult batchGetItem(
        Map<String, KeysAndAttributes> requestItems,
        String returnConsumedCapacity) throws AmazonServiceException,
        AmazonClientException {
    BatchGetItemRequest request = new BatchGetItemRequest()
            .withRequestItems(requestItems)
            .withReturnConsumedCapacity(returnConsumedCapacity);
    return batchGetItem(request);
}
 
Example #6
Source File: TransactionManagerDynamoDBFacade.java    From dynamodb-transactions with Apache License 2.0 5 votes vote down vote up
@Override
public BatchGetItemResult batchGetItem(
        Map<String, KeysAndAttributes> requestItems)
        throws AmazonServiceException, AmazonClientException {
    BatchGetItemRequest request = new BatchGetItemRequest()
            .withRequestItems(requestItems);
    return batchGetItem(request);
}
 
Example #7
Source File: PostgresDynamoDB.java    From podyn with Apache License 2.0 4 votes vote down vote up
@Override
public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) {
	throw new UnsupportedOperationException();
}
 
Example #8
Source File: ThreadLocalDynamoDBFacade.java    From dynamodb-transactions with Apache License 2.0 4 votes vote down vote up
@Override
public BatchGetItemResult batchGetItem(BatchGetItemRequest request) throws AmazonServiceException, AmazonClientException {
    return getBackend().batchGetItem(request);
}
 
Example #9
Source File: TransactionDynamoDBFacade.java    From dynamodb-transactions with Apache License 2.0 4 votes vote down vote up
@Override
public BatchGetItemResult batchGetItem(BatchGetItemRequest arg0)
        throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Use the underlying client instance instead");
}