/** * <p> * The name of the table containing the requested item. * </p> * * @param tableName * The name of the table containing the requested item. * @return Returns a reference to this object so that method calls can be chained together. */ public GetItemRequest withTableName(String tableName) { setTableName(tableName); return this; }
/** * Constructs a new GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param tableName * The name of the table containing the requested item. * @param key * A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item * to retrieve.</p> * <p> * For the primary key, you must provide all of the attributes. For example, with a simple primary key, you * only need to provide a value for the partition key. For a composite primary key, you must provide values * for both the partition key and the sort key. */ public GetItemRequest(String tableName, java.util.Map<String, AttributeValue> key) { setTableName(tableName); setKey(key); }
/** * Constructs a new GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param tableName * The name of the table containing the requested item. * @param key * A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item * to retrieve.</p> * <p> * For the primary key, you must provide all of the attributes. For example, with a simple primary key, you * only need to provide a value for the partition key. For a composite primary key, you must provide values * for both the partition key and the sort key. * @param consistentRead * Determines the read consistency model: If set to <code>true</code>, then the operation uses strongly * consistent reads; otherwise, the operation uses eventually consistent reads. */ public GetItemRequest(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { setTableName(tableName); setKey(key); setConsistentRead(consistentRead); }
@Override public <T extends Object> T load(T keyObject, DynamoDBMapperConfig config) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) keyObject.getClass(); config = mergeConfig(config); final DynamoDBMapperTableModel<T> model = getTableModel(clazz, config); String tableName = getTableName(clazz, keyObject, config); GetItemRequest rq = new GetItemRequest() .withRequestMetricCollector(config.getRequestMetricCollector()); Map<String, AttributeValue> key = model.convertKey(keyObject); rq.setKey(key); rq.setTableName(tableName); rq.setConsistentRead(config.getConsistentReads() == ConsistentReads.CONSISTENT); GetItemResult item = db.getItem(applyUserAgent(rq)); Map<String, AttributeValue> itemAttributes = item.getItem(); if ( itemAttributes == null ) { return null; } T object = privateMarshallIntoObject( toParameters(itemAttributes, clazz, tableName, config)); return object; }
/** * Constructs a new GetItemRequest object. Callers should use the setter or * fluent setter (with...) methods to initialize any additional object * members. * * @param tableName <p> * The name of the table containing the requested item. * </p> * @param key <p> * A map of attribute names to <code>AttributeValue</code> * objects, representing the primary key of the item to retrieve. * </p> * <p> * For the primary key, you must provide all of the attributes. * For example, with a simple primary key, you only need to * provide a value for the partition key. For a composite primary * key, you must provide values for both the partition key and * the sort key. * </p> */ public GetItemRequest(String tableName, java.util.Map<String, AttributeValue> key) { setTableName(tableName); setKey(key); }
setTableName(tableName); setKey(key); setConsistentRead(consistentRead);
throws AmazonServiceException, AmazonClientException { GetItemRequest getItemRequest = new GetItemRequest(); getItemRequest.setTableName(tableName); getItemRequest.setKey(key); return getItem(getItemRequest);
throws AmazonServiceException, AmazonClientException { GetItemRequest getItemRequest = new GetItemRequest(); getItemRequest.setTableName(tableName); getItemRequest.setKey(key); getItemRequest.setConsistentRead(consistentRead);
/** * <p> * The name of the table containing the requested item. * </p> * * @param tableName * The name of the table containing the requested item. * @return Returns a reference to this object so that method calls can be chained together. */ public GetItemRequest withTableName(String tableName) { setTableName(tableName); return this; }
rq.setTableName(tableName); rq.setConsistentRead(config.getConsistentReads() == ConsistentReads.CONSISTENT);
/** * Constructs a new GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param tableName * The name of the table containing the requested item. * @param key * A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item * to retrieve.</p> * <p> * For the primary key, you must provide all of the attributes. For example, with a simple primary key, you * only need to provide a value for the partition key. For a composite primary key, you must provide values * for both the partition key and the sort key. */ public GetItemRequest(String tableName, java.util.Map<String, AttributeValue> key) { setTableName(tableName); setKey(key); }
/** * Constructs a new GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param tableName * The name of the table containing the requested item. * @param key * A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item * to retrieve.</p> * <p> * For the primary key, you must provide all of the attributes. For example, with a simple primary key, you * only need to provide a value for the partition key. For a composite primary key, you must provide values * for both the partition key and the sort key. * @param consistentRead * Determines the read consistency model: If set to <code>true</code>, then the operation uses strongly * consistent reads; otherwise, the operation uses eventually consistent reads. */ public GetItemRequest(String tableName, java.util.Map<String, AttributeValue> key, Boolean consistentRead) { setTableName(tableName); setKey(key); setConsistentRead(consistentRead); }
/** * Makes a GetItemRequest for a given attribute. * @param attr Attribute name * @return GetItemRequest */ private GetItemRequest makeItemRequestFor(final String attr) { final GetItemRequest request = new GetItemRequest(); request.setTableName(this.name); request.setAttributesToGet(Collections.singletonList(attr)); request.setKey(this.attributes.only(this.keys)); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); request.setConsistentRead(true); return request; }
request.setTableName(table); request.setKey(serializer.getDynamoHashKey(leaseKey)); request.setConsistentRead(consistentReads);
/** * Makes a GetItemRequest for a given attribute. * @param attr Attribute name * @return GetItemRequest */ private GetItemRequest makeItemRequestFor(final String attr) { final GetItemRequest request = new GetItemRequest(); request.setTableName(this.name); request.setAttributesToGet(Collections.singletonList(attr)); request.setKey(this.attributes.only(this.keys)); request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); request.setConsistentRead(true); return request; }
public GetPointResult getPoint(GetPointRequest getPointRequest) { long geohash = S2Manager.generateGeohash(getPointRequest.getGeoPoint()); long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength()); GetItemRequest getItemRequest = getPointRequest.getGetItemRequest(); getItemRequest.setTableName(config.getTableName()); AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey)); getItemRequest.getKey().put(config.getHashKeyAttributeName(), hashKeyValue); getItemRequest.getKey().put(config.getRangeKeyAttributeName(), getPointRequest.getRangeKeyValue()); GetItemResult getItemResult = config.getDynamoDBClient().getItem(getItemRequest); GetPointResult getPointResult = new GetPointResult(getItemResult); return getPointResult; }
@Override public <T extends Object> T load(T keyObject, DynamoDBMapperConfig config) { @SuppressWarnings("unchecked") Class<T> clazz = (Class<T>) keyObject.getClass(); config = mergeConfig(config); final DynamoDBMapperTableModel<T> model = getTableModel(clazz, config); String tableName = getTableName(clazz, keyObject, config); GetItemRequest rq = new GetItemRequest() .withRequestMetricCollector(config.getRequestMetricCollector()); Map<String, AttributeValue> key = model.convertKey(keyObject); rq.setKey(key); rq.setTableName(tableName); rq.setConsistentRead(config.getConsistentReads() == ConsistentReads.CONSISTENT); GetItemResult item = db.getItem(applyUserAgent(rq)); Map<String, AttributeValue> itemAttributes = item.getItem(); if ( itemAttributes == null ) { return null; } T object = privateMarshallIntoObject( toParameters(itemAttributes, clazz, tableName, config)); return object; }