List of usage examples for com.amazonaws.services.dynamodbv2.model GetItemRequest withAttributesToGet
public GetItemRequest withAttributesToGet(java.util.Collection<String> attributesToGet)
This is a legacy parameter.
From source file:com.clicktravel.infrastructure.persistence.aws.dynamodb.DynamoDbTemplate.java
License:Apache License
private Map<String, AttributeValue> readRaw(final ItemId itemId, final Class<? extends Item> itemClass, final Collection<String> attributes) { final ItemConfiguration itemConfiguration = getItemConfiguration(itemClass); final String tableName = databaseSchemaHolder.schemaName() + "." + itemConfiguration.tableName(); final GetItemRequest getItemRequest = new GetItemRequest(tableName, generateKey(itemId, itemConfiguration)); if (attributes.size() > 0) { getItemRequest.withAttributesToGet(attributes); }//from w ww. ja v a 2 s . c o m final GetItemResult getItemResult; try { getItemResult = amazonDynamoDbClient.getItem(getItemRequest); } catch (final AmazonServiceException e) { throw new PersistenceResourceFailureException("Failure while attempting to read from DynamoDB table", e); } if (getItemResult == null || getItemResult.getItem() == null) { throw new NonExistentItemException(String.format("The item of type [%s] with id [%s] does not exist", itemClass.getName(), itemId)); } else { return getItemResult.getItem(); } }