Package com.amazonaws.services.dynamodb.datamodeling

Examples of com.amazonaws.services.dynamodb.datamodeling.DynamoDBQueryExpression


   * 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;
  }
View Full Code Here


   * 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;
  }
View Full Code Here

        putItemWithHashKey();
        putItemWithHashKeyOverwriteItem();

        String code = "hash1";

        DynamoDBQueryExpression query =
                new DynamoDBQueryExpression(new AttributeValue().withS(code));

        List<TestClassWithHashKey> valueList = mapper.query(TestClassWithHashKey.class, query);
        Assert.assertNotNull("Value list is null.", valueList);
        Assert.assertNotSame("Value list is empty.", 0, valueList.size());
View Full Code Here

  public void queryWithUnknownHashKey() {
        putItemWithHashKey();

        String code = "hash1x";

        DynamoDBQueryExpression query =
                new DynamoDBQueryExpression(new AttributeValue().withS(code));

        List<TestClassWithHashKey> valueList = mapper.query(TestClassWithHashKey.class, query);
        Assert.assertNotNull("Value list is null.", valueList);
        Assert.assertEquals("Value list should be empty.", 0, valueList.size());
  }
View Full Code Here

        value2e.setIntData(25);
        mapper.save(value2e);

        String hashCode = "hash2";

        DynamoDBQueryExpression query =
                new DynamoDBQueryExpression(new AttributeValue().withS(hashCode));

    Condition rangeKeyCondition = new Condition();
    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(new AttributeValue().withS("range2c"));
    attributeValueList.add(new AttributeValue().withS("range2d"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.BETWEEN);
    query.setRangeKeyCondition(rangeKeyCondition);

        List<TestClassWithHashRangeKey> valueList = mapper.query(TestClassWithHashRangeKey.class, query);
        Assert.assertNotNull("Value list is null.", valueList);
        Assert.assertNotSame("Value list is empty.", 0, valueList.size());
View Full Code Here

  public void queryWithUnknownHashRangeKey1() {
        putItemWithHashKeyAndRangeKey();

        String hashCode = "hash1x";

        DynamoDBQueryExpression query =
                new DynamoDBQueryExpression(new AttributeValue().withS(hashCode));

        List<TestClassWithHashRangeKey> valueList = mapper.query(TestClassWithHashRangeKey.class, query);
        Assert.assertNotNull("Value list is null.", valueList);
        Assert.assertEquals("Value list should be empty.", 0, valueList.size());
  }
View Full Code Here

  public void queryWithUnknownHashRangeKey2() {
        putItemWithHashKeyAndRangeKey();

        String hashCode = "hash2";

        DynamoDBQueryExpression query =
                new DynamoDBQueryExpression(new AttributeValue().withS(hashCode));

    Condition rangeKeyCondition = new Condition();
    List<AttributeValue> attributeValueList = new ArrayList<AttributeValue>();
    attributeValueList.add(new AttributeValue().withS("range2x"));
    attributeValueList.add(new AttributeValue().withS("range2y"));
    rangeKeyCondition.setAttributeValueList(attributeValueList);
    rangeKeyCondition.setComparisonOperator(ComparisonOperator.BETWEEN);
    query.setRangeKeyCondition(rangeKeyCondition);

        List<TestClassWithHashRangeKey> valueList = mapper.query(TestClassWithHashRangeKey.class, query);
        Assert.assertNotNull("Value list is null.", valueList);
        Assert.assertEquals("Value list should be empty.", 0, valueList.size());
  }
View Full Code Here

      c.setHashCode("code");
      c.setRangeCode("2");
      c.setStringData("second");
      mapper.save(c);
    }
    TestClassWithHashRangeKey res = mapper.query(TestClassWithHashRangeKey.class, new DynamoDBQueryExpression(new AttributeValue("code")).withScanIndexForward(false).withLimit(1)).get(0);
    Assert.assertEquals("second", res.getStringData());
  }
View Full Code Here

      c.setHashCode("code");
      c.setRangeCode(i + "");
      mapper.save(c);
    }

    Assert.assertEquals(1, mapper.query(TestClassWithHashRangeKey.class, new DynamoDBQueryExpression(new AttributeValue("code")).withLimit(1)).size());
    Assert.assertEquals(3, mapper.query(TestClassWithHashRangeKey.class, new DynamoDBQueryExpression(new AttributeValue("code")).withLimit(3)).size());
    Assert.assertEquals(10, mapper.query(TestClassWithHashRangeKey.class, new DynamoDBQueryExpression(new AttributeValue("code")).withLimit(20)).size());
  }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.datamodeling.DynamoDBQueryExpression

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.