Example usage for com.amazonaws.services.dynamodbv2.model GetItemRequest getKey

List of usage examples for com.amazonaws.services.dynamodbv2.model GetItemRequest getKey

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model GetItemRequest getKey.

Prototype


public java.util.Map<String, AttributeValue> getKey() 

Source Link

Document

A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

Usage

From source file:amazon.dynamodb.config.DynamoDBManager.java

License:Open Source License

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;
}