/** * Builds range query expression * @param pNewConditionCondition for querying * @param pHashAttrValueHash attribute value where to start */ public void buildQueryExpression(Condition pNewCondition, AttributeValue pHashAttrValue) { DynamoDBQueryExpression newQueryExpression = new DynamoDBQueryExpression(pHashAttrValue); newQueryExpression.setConsistentRead(getConsistencyReadLevel()); newQueryExpression.setRangeKeyCondition(pNewCondition); dynamoDBExpression = newQueryExpression; }
/** * Executes a query after building a DynamoDB specific query based on the received one */ @Override public Result<K, T> execute(Query<K, T> query) { DynamoDBQuery<K, T> dynamoDBQuery = buildDynamoDBQuery(query); DynamoDBMapper mapper = new DynamoDBMapper(dynamoDBClient); List<T> objList = null; if (DynamoDBQuery.getType().equals(DynamoDBQuery.RANGE_QUERY)) objList = mapper.query(persistentClass, (DynamoDBQueryExpression)dynamoDBQuery.getQueryExpression()); if (DynamoDBQuery.getType().equals(DynamoDBQuery.SCAN_QUERY)) objList = mapper.scan(persistentClass, (DynamoDBScanExpression)dynamoDBQuery.getQueryExpression()); return new DynamoDBResult<K, T>(this, query, objList); }