List of usage examples for com.amazonaws.services.dynamodbv2.model QueryRequest setTableName
public void setTableName(String tableName)
The name of the table containing the requested items.
From source file:org.socialsignin.spring.data.dynamodb.repository.query.AbstractDynamoDBQueryCriteria.java
License:Apache License
protected QueryRequest buildQueryRequest(String tableName, String theIndexName, String hashKeyAttributeName, String rangeKeyAttributeName, String rangeKeyPropertyName, List<Condition> hashKeyConditions, List<Condition> rangeKeyConditions) { // TODO Set other query request properties based on config QueryRequest queryRequest = new QueryRequest(); queryRequest.setTableName(tableName); queryRequest.setIndexName(theIndexName); if (isApplicableForGlobalSecondaryIndex()) { List<String> allowedSortProperties = new ArrayList<String>(); for (Entry<String, List<Condition>> singlePropertyCondition : propertyConditions.entrySet()) { if (entityInformation.getGlobalSecondaryIndexNamesByPropertyName().keySet() .contains(singlePropertyCondition.getKey())) { allowedSortProperties.add(singlePropertyCondition.getKey()); }//from w w w. j a va 2 s .c o m } HashMap<String, Condition> keyConditions = new HashMap<String, Condition>(); if (hashKeyConditions != null && hashKeyConditions.size() > 0) { for (Condition hashKeyCondition : hashKeyConditions) { keyConditions.put(hashKeyAttributeName, hashKeyCondition); allowedSortProperties.add(hashKeyPropertyName); } } if (rangeKeyConditions != null && rangeKeyConditions.size() > 0) { for (Condition rangeKeyCondition : rangeKeyConditions) { keyConditions.put(rangeKeyAttributeName, rangeKeyCondition); allowedSortProperties.add(rangeKeyPropertyName); } } for (Entry<String, List<Condition>> singleAttributeConditions : attributeConditions.entrySet()) { for (Condition condition : singleAttributeConditions.getValue()) { keyConditions.put(singleAttributeConditions.getKey(), condition); } } if (sort != null) { for (Order order : sort) { final String sortProperty = order.getProperty(); if (entityInformation.isGlobalIndexRangeKeyProperty(sortProperty)) { allowedSortProperties.add(sortProperty); } } } queryRequest.setKeyConditions(keyConditions); queryRequest.setSelect(Select.ALL_PROJECTED_ATTRIBUTES); applySortIfSpecified(queryRequest, new ArrayList<String>(new HashSet<String>(allowedSortProperties))); } return queryRequest; }