Example usage for com.amazonaws.services.dynamodbv2.model QueryRequest getKeyConditions

List of usage examples for com.amazonaws.services.dynamodbv2.model QueryRequest getKeyConditions

Introduction

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

Prototype


public java.util.Map<String, Condition> getKeyConditions() 

Source Link

Document

This is a legacy parameter.

Usage

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

License:Open Source License

public static QueryRequest copyQueryRequest(QueryRequest queryRequest) {
    QueryRequest copiedQueryRequest = new QueryRequest().withAttributesToGet(queryRequest.getAttributesToGet())
            .withConsistentRead(queryRequest.getConsistentRead())
            .withExclusiveStartKey(queryRequest.getExclusiveStartKey())
            .withIndexName(queryRequest.getIndexName()).withKeyConditions(queryRequest.getKeyConditions())
            .withLimit(queryRequest.getLimit())
            .withReturnConsumedCapacity(queryRequest.getReturnConsumedCapacity())
            .withScanIndexForward(queryRequest.getScanIndexForward()).withSelect(queryRequest.getSelect())
            .withTableName(queryRequest.getTableName());

    return copiedQueryRequest;
}

From source file:org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCriteria.java

License:Apache License

protected void applySortIfSpecified(QueryRequest queryRequest, List<String> permittedPropertyNames) {
    if (permittedPropertyNames.size() > 2) {
        throw new UnsupportedOperationException("Can only sort by at most a single global hash and range key");
    }//from   ww  w . j  a  v  a 2 s  .  c  o  m

    if (sort != null) {
        boolean sortAlreadySet = false;
        for (Order order : sort) {
            if (permittedPropertyNames.contains(order.getProperty())) {
                if (sortAlreadySet) {
                    throw new UnsupportedOperationException("Sorting by multiple attributes not possible");

                }
                if (queryRequest.getKeyConditions().size() > 1 && !hasIndexHashKeyEqualCondition()) {
                    throw new UnsupportedOperationException(
                            "Sorting for global index queries with criteria on both hash and range not possible");

                }
                queryRequest.setScanIndexForward(order.getDirection().equals(Direction.ASC));
                sortAlreadySet = true;
            } else {
                throw new UnsupportedOperationException(
                        "Sorting only possible by " + permittedPropertyNames + " for the criteria specified");
            }
        }
    }
}