Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.model.QueryResult


     *             DynamoDB.
     */
    public <T> List<T> query(Class<T> clazz, DynamoDBQueryExpression queryExpression) throws Exception {
        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression);

        QueryResult queryResult = db.query(queryRequest);
        int count = queryResult.getCount();

        // If the results are truncated, figure out the count
        if (queryResult.getLastEvaluatedKey() != null) {
            count = count(clazz, queryExpression);
        }

        return new PaginatedQueryList<T>(this, clazz, db, count, queryRequest, queryResult);
    }
View Full Code Here


        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression);
        queryRequest.setCount(true);

        // Count queries can also be truncated for large datasets
        int count = 0;
        QueryResult queryResult = null;
        do {
            queryResult = db.query(queryRequest);
            count += queryResult.getCount();
            queryRequest.setExclusiveStartKey(queryResult.getLastEvaluatedKey());
        } while (queryResult.getLastEvaluatedKey() != null);

        return count;
    }
View Full Code Here

    public <T> PaginatedQueryList<T> query(Class<T> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);

        QueryResult queryResult = db.query(applyUserAgent(queryRequest));
        return new PaginatedQueryList<T>(this, clazz, db, queryRequest, queryResult);
    }
View Full Code Here

    public <T> QueryResultPage<T> queryPage(Class<T> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);

        QueryResult scanResult = db.query(applyUserAgent(queryRequest));
        QueryResultPage<T> result = new QueryResultPage<T>();
        result.setResults(marshallIntoObjects(clazz, scanResult.getItems()));
        result.setLastEvaluatedKey(scanResult.getLastEvaluatedKey());
       
        return result;
    }
View Full Code Here

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);
        queryRequest.setCount(true);

        // Count queries can also be truncated for large datasets
        int count = 0;
        QueryResult queryResult = null;
        do {
            queryResult = db.query(applyUserAgent(queryRequest));
            count += queryResult.getCount();
            queryRequest.setExclusiveStartKey(queryResult.getLastEvaluatedKey());
        } while (queryResult.getLastEvaluatedKey() != null);

        return count;
    }
View Full Code Here

        try {
            if (toRequest(query, queryReq, scanReq)) {
                if (continueFromLastRun)
                    queryReq.setExclusiveStartKey((Key)query.nextKey);
                QueryResult result = ddbClient.query(queryReq);
                query.nextKey = result.getLastEvaluatedKey();
                items = result.getItems();
            } else {
                if (continueFromLastRun)
                    queryReq.setExclusiveStartKey((Key)query.nextKey);
                ScanResult  result = ddbClient.scan(scanReq);
                query.nextKey = result.getLastEvaluatedKey();
                items = result.getItems();
            }
            for (Map<String, AttributeValue> item : items) {
                T   obj = itemToObj(modelClass, item);
                resultObjs.add(obj);
            }
View Full Code Here

    public <T> PaginatedQueryList<T> query(Class<T> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);

        QueryResult queryResult = db.query(applyUserAgent(queryRequest));
        return new PaginatedQueryList<T>(this, clazz, db, queryRequest, queryResult);
    }
View Full Code Here

    public <T> QueryResultPage<T> queryPage(Class<T> clazz, DynamoDBQueryExpression queryExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);

        QueryResult scanResult = db.query(applyUserAgent(queryRequest));
        QueryResultPage<T> result = new QueryResultPage<T>();
        result.setResults(marshallIntoObjects(clazz, scanResult.getItems()));
        result.setLastEvaluatedKey(scanResult.getLastEvaluatedKey());
       
        return result;
    }
View Full Code Here

        QueryRequest queryRequest = createQueryRequestFromExpression(clazz, queryExpression, config);
        queryRequest.setCount(true);

        // Count queries can also be truncated for large datasets
        int count = 0;
        QueryResult queryResult = null;
        do {
            queryResult = db.query(applyUserAgent(queryRequest));
            count += queryResult.getCount();
            queryRequest.setExclusiveStartKey(queryResult.getLastEvaluatedKey());
        } while (queryResult.getLastEvaluatedKey() != null);

        return count;
    }
View Full Code Here

        for(Path path : paths) {
            Key startKey = null;
           
            do {
                RetryTask<QueryResult> queryTask = new RetryTask(new QueryTask(path, startKey), retryCount, timeout);
                QueryResult result = queryTask.call();
               
                for(Map<String, AttributeValue> item : result.getItems()) {
                    FileInfo file = new FileInfo(new Path(scheme+":"+item.get(HASH_KEY).getS() +"/"+ item.get(RANGE_KEY).getS()));
                   
                    if(item.containsKey(DELETE_MARKER)) {
                        file.setDeleted(Boolean.parseBoolean(item.get(DELETE_MARKER).getS()));
                       
                        //@TODO: cleanup deleteMarker logic after deployed
                        if(!includeDeleted) {
                            continue;
                        }
                    }
                   
                    if(item.containsKey(DIRECTORY_VALUE)) {
                        file.setDirectory(Boolean.parseBoolean((item.get(DIRECTORY_VALUE).getS())));
                    }
                   
                    listing.add(file);
                }
               
                startKey = result.getLastEvaluatedKey();
            } while(startKey != null);
        }
       
        return listing;
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.QueryResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.