Example usage for com.amazonaws.services.dynamodbv2.datamodeling KeyPair KeyPair

List of usage examples for com.amazonaws.services.dynamodbv2.datamodeling KeyPair KeyPair

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.datamodeling KeyPair KeyPair.

Prototype

KeyPair

Source Link

Usage

From source file:org.socialsignin.spring.data.dynamodb.repository.support.SimpleDynamoDBCrudRepository.java

License:Apache License

@SuppressWarnings("unchecked")
public List<T> findAll(Iterable<ID> ids) {
    Map<Class<?>, List<KeyPair>> keyPairsMap = new HashMap<Class<?>, List<KeyPair>>();
    List<KeyPair> keyPairs = new ArrayList<KeyPair>();
    for (ID id : ids) {
        if (entityInformation.isRangeKeyAware()) {
            keyPairs.add(new KeyPair().withHashKey(entityInformation.getHashKey(id))
                    .withRangeKey(entityInformation.getRangeKey(id)));
        } else {//from  ww  w  .j  a  v  a 2s  .c  o  m
            keyPairs.add(new KeyPair().withHashKey(id));
        }
    }
    keyPairsMap.put(domainType, keyPairs);
    return (List<T>) dynamoDBOperations.batchLoad(keyPairsMap).get(
            dynamoDBOperations.getOverriddenTableName(domainType, entityInformation.getDynamoDBTableName()));
}

From source file:org.socialsignin.spring.data.dynamodb.repository.support.SimpleDynamoDBCrudRepository.java

License:Apache License

@SuppressWarnings("unchecked")
protected List<T> loadBatch(Iterable<ID> ids) {
    Map<Class<?>, List<KeyPair>> keyPairsMap = new HashMap<Class<?>, List<KeyPair>>();
    List<KeyPair> keyPairs = new ArrayList<KeyPair>();
    for (ID id : ids) {
        if (entityInformation.isRangeKeyAware()) {
            keyPairs.add(new KeyPair().withHashKey(entityInformation.getHashKey(id))
                    .withRangeKey(entityInformation.getRangeKey(id)));
        } else {/*from w w w .  ja  va  2s  . co m*/
            keyPairs.add(new KeyPair().withHashKey(id));

        }
    }
    keyPairsMap.put(domainType, keyPairs);
    return (List<T>) dynamoDBOperations.batchLoad(keyPairsMap).get(domainType);
}