com.amazonaws.services.dynamodbv2.datamodeling.PaginatedQueryList Java Examples

The following examples show how to use com.amazonaws.services.dynamodbv2.datamodeling.PaginatedQueryList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HashKeyOnlyTableWithGSIITCase.java    From aws-dynamodb-encryption-java with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that we can query using the hash/range GSI on our hash-key only
 * table.
 */
@Test
public void testGSIQuery() throws Exception {
    DynamoDBMapper mapper = TestDynamoDBMapperFactory
            .createDynamoDBMapper(dynamo);
    String status = "foo-status";

    User user = new User();
    user.setId("123");
    user.setStatus(status);
    user.setTs("321");
    mapper.save(user);

    DynamoDBQueryExpression<User> expr = new DynamoDBQueryExpression<User>()
            .withIndexName("statusAndCreation")
            .withLimit(100)
            .withConsistentRead(false)
            .withHashKeyValues(user)
            .withRangeKeyCondition(
                    "ts",
                    new Condition()
                    .withComparisonOperator(ComparisonOperator.GT)
                    .withAttributeValueList(new AttributeValue("100")));

    PaginatedQueryList<User> query = mapper.query(User.class, expr);
    int size = query.size();
    if (DEBUG)
        System.err.println("size=" + size);
    assertTrue(1 == size);
    assertEquals(status, query.get(0).getStatus());
}
 
Example #2
Source File: DynamoDBTemplate.java    From spring-data-dynamodb with Apache License 2.0 6 votes vote down vote up
@Override
public <T> PaginatedQueryList<T> query(Class<T> domainClass,
		DynamoDBQueryExpression<T> queryExpression) {
	PaginatedQueryList<T> results = dynamoDBMapper.query(domainClass, queryExpression);
	maybeEmitEvent(new AfterQueryEvent<T>(results));
	return results;
}
 
Example #3
Source File: DynamoDBTemplate.java    From spring-data-dynamodb with Apache License 2.0 5 votes vote down vote up
@Override
public <T> PaginatedQueryList<T> query(Class<T> clazz,
		QueryRequest queryRequest) {
	QueryResult queryResult = amazonDynamoDB.query(queryRequest);
	return new PaginatedQueryList<T>(dynamoDBMapper, clazz, amazonDynamoDB, queryRequest, queryResult,
			dynamoDBMapperConfig.getPaginationLoadingStrategy(), dynamoDBMapperConfig);
}
 
Example #4
Source File: AfterQueryEvent.java    From spring-data-dynamodb with Apache License 2.0 4 votes vote down vote up
public AfterQueryEvent(PaginatedQueryList<T> source) {
	super(source);
}
 
Example #5
Source File: DynamoDBOperations.java    From spring-data-dynamodb with Apache License 2.0 votes vote down vote up
public <T> PaginatedQueryList<T> query(Class<T> clazz, QueryRequest queryRequest); 
Example #6
Source File: DynamoDBOperations.java    From spring-data-dynamodb with Apache License 2.0 votes vote down vote up
public <T> PaginatedQueryList<T> query(Class<T> domainClass,DynamoDBQueryExpression<T> queryExpression);