private void addKeyCondition(QueryRequest req, String keyName, ComparisonOperator comparison, AttributeValue... values) { Map<String, Condition> currentConditions = req.getKeyConditions(); Condition currentCondition = currentConditions == null ? null : currentConditions.get(keyName); Condition newCondition = new Condition().withComparisonOperator(comparison) .withAttributeValueList(values); // If there's already a condition on the key in the item, make sure it's not any different than the condition they // specified in the query spec if (currentCondition == null) { req.addKeyConditionsEntry(keyName, newCondition); } else if (!currentCondition.equals(newCondition)) { throw new IllegalArgumentException("a different condition was specified for '" + keyName + "' in the query spec " + "and the query request"); } }
private void addKeyCondition(QueryRequest req, String keyName, ComparisonOperator comparison, AttributeValue... values) { Map<String, Condition> currentConditions = req.getKeyConditions(); Condition currentCondition = currentConditions == null ? null : currentConditions.get(keyName); Condition newCondition = new Condition().withComparisonOperator(comparison) .withAttributeValueList(values); // If there's already a condition on the key in the item, make sure it's not any different than the condition they // specified in the query spec if (currentCondition == null) { req.addKeyConditionsEntry(keyName, newCondition); } else if (!currentCondition.equals(newCondition)) { throw new IllegalArgumentException("a different condition was specified for '" + keyName + "' in the query spec " + "and the query request"); } }
private List<QueryRequest> getAdapterOnlyQueryRequests( final String tableName, final ArrayList<Short> internalAdapterIds) { final List<QueryRequest> allQueries = new ArrayList<>(); for (final short internalAdapterId : internalAdapterIds) { final QueryRequest singleAdapterQuery = new QueryRequest(tableName); final byte[] start = ByteArrayUtils.shortToByteArray(internalAdapterId); final byte[] end = new ByteArray(start).getNextPrefix(); singleAdapterQuery.addKeyConditionsEntry( DynamoDBRow.GW_RANGE_KEY, new Condition().withComparisonOperator(ComparisonOperator.BETWEEN).withAttributeValueList( new AttributeValue().withB(ByteBuffer.wrap(start)), new AttributeValue().withB(ByteBuffer.wrap(end)))); allQueries.add(singleAdapterQuery); } return allQueries; }
final byte[] end; final QueryRequest query = new QueryRequest(tableName).addKeyConditionsEntry( DynamoDBRow.GW_PARTITION_ID_KEY, new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList( query.addKeyConditionsEntry( DynamoDBRow.GW_RANGE_KEY, new Condition().withComparisonOperator(ComparisonOperator.BETWEEN).withAttributeValueList(