Package com.amazonaws.services.dynamodbv2.model

Examples of com.amazonaws.services.dynamodbv2.model.Condition


            putItemResult = dynamoDB.putItem(putItemRequest);
            System.out.println("Result: " + putItemResult);

            // Scan items for movies with a year attribute greater than 1985
            HashMap<String, Condition> scanFilter = new HashMap<String, Condition>();
            Condition condition = new Condition()
                .withComparisonOperator(ComparisonOperator.GT.toString())
                .withAttributeValueList(new AttributeValue().withN("1985"));
            scanFilter.put("year", condition);
            ScanRequest scanRequest = new ScanRequest(tableName).withScanFilter(scanFilter);
            ScanResult scanResult = dynamoDB.scan(scanRequest);
View Full Code Here


        Map<String, Condition> conditions = new HashMap<String, Condition>();
        for ( Method getter : reflector.getKeyGetters(obj.getClass()) ) {
            if ( getter.isAnnotationPresent(DynamoDBHashKey.class) ) {
                conditions.put(
                        reflector.getAttributeName(getter),
                        new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                getSimpleAttributeValue(getter, safeInvoke(getter, obj, (Object[])null))));
            }
        }
        return conditions;
    }
View Full Code Here

        Map<String, Condition> conditions = new HashMap<String, Condition>();
        for ( Method getter : reflector.getKeyGetters(obj.getClass()) ) {
            if ( getter.isAnnotationPresent(DynamoDBHashKey.class) ) {
                conditions.put(
                        reflector.getAttributeName(getter),
                        new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                getSimpleAttributeValue(getter, safeInvoke(getter, obj, (Object[])null))));
            }
        }
        return conditions;
    }
View Full Code Here

        String tableName = getTable().getTableName();
        QueryRequest req = spec.getRequest().withTableName(tableName);
        // hash key
        final KeyAttribute hashKey = spec.getHashKey();
        req.addKeyConditionsEntry(hashKey.getName(),
                new Condition()
                .withComparisonOperator(ComparisonOperator.EQ)
                .withAttributeValueList(InternalUtils.toAttributeValue(hashKey.getValue()))
        );
        // range key condition
        RangeKeyCondition rangeKeyCond = spec.getRangeKeyCondition();
        if (rangeKeyCond != null) {
            KeyConditions keyCond = rangeKeyCond.getKeyCondition();
            if (keyCond == null)
                throw new IllegalArgumentException("key condition not specified in range key condition");
            Object[] values = rangeKeyCond.getValues();
            if (values == null)
                throw new IllegalArgumentException("key condition values not specified in range key condition");
            req.addKeyConditionsEntry(rangeKeyCond.getAttrName(),
                    new Condition()
                    .withComparisonOperator(keyCond.toComparisonOperator())
                    .withAttributeValueList(InternalUtils.toAttributeValues(values))
            );
        }
        // query filters;
View Full Code Here

                        || ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexHashKey.class) ) {
                    Object getterReturnResult = safeInvoke(getter, obj, (Object[])null);
                    if (getterReturnResult != null) {
                        conditions.put(
                                reflector.getAttributeName(getter),
                                new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                        getSimpleAttributeValue(getter, getterReturnResult)));
                    }
                }
            }
        }
View Full Code Here

    Map<String, AttributeValue> lastEvaluatedKey = null;

    do {
      Map<String, Condition> keyConditions = new HashMap<String, Condition>();

      Condition hashKeyCondition = new Condition().withComparisonOperator(ComparisonOperator.EQ)
          .withAttributeValueList(new AttributeValue().withN(String.valueOf(hashKey)));
      keyConditions.put(config.getHashKeyAttributeName(), hashKeyCondition);

      AttributeValue minRange = new AttributeValue().withN(Long.toString(range.getRangeMin()));
      AttributeValue maxRange = new AttributeValue().withN(Long.toString(range.getRangeMax()));

      Condition geohashCondition = new Condition().withComparisonOperator(ComparisonOperator.BETWEEN)
          .withAttributeValueList(minRange, maxRange);
      keyConditions.put(config.getGeohashAttributeName(), geohashCondition);

      queryRequest.withTableName(config.getTableName()).withKeyConditions(keyConditions)
          .withIndexName(config.getGeohashIndexName()).withConsistentRead(true)
View Full Code Here

                        || ReflectionUtils.getterOrFieldHasAnnotation(getter, DynamoDBIndexHashKey.class) ) {
                    Object getterReturnResult = safeInvoke(getter, obj, (Object[])null);
                    if (getterReturnResult != null) {
                        conditions.put(
                                reflector.getAttributeName(getter),
                                new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                        getSimpleAttributeValue(getter, getterReturnResult)));
                    }
                }
            }
        }
View Full Code Here

        Map<String, Condition> conditions = new HashMap<String, Condition>();
        for ( Method getter : reflector.getKeyGetters(obj.getClass()) ) {
            if ( getter.isAnnotationPresent(DynamoDBHashKey.class) ) {
                conditions.put(
                        reflector.getAttributeName(getter),
                        new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                getSimpleAttributeValue(getter, safeInvoke(getter, obj, (Object[])null))));
            }
        }
        return conditions;
    }
View Full Code Here

        Map<String, Condition> conditions = new HashMap<String, Condition>();
        for ( Method getter : reflector.getKeyGetters(obj.getClass()) ) {
            if ( getter.isAnnotationPresent(DynamoDBHashKey.class) ) {
                conditions.put(
                        reflector.getAttributeName(getter),
                        new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                getSimpleAttributeValue(getter, safeInvoke(getter, obj, (Object[])null))));
            }
        }
        return conditions;
    }
View Full Code Here

                    || getter.isAnnotationPresent(DynamoDBIndexHashKey.class) ) {
                Object getterReturnResult = safeInvoke(getter, obj, (Object[])null);
                if (getterReturnResult != null) {
                    conditions.put(
                            reflector.getAttributeName(getter),
                            new Condition().withComparisonOperator(ComparisonOperator.EQ).withAttributeValueList(
                                    getSimpleAttributeValue(getter, getterReturnResult)));
                }
            }
        }
        return conditions;
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.Condition

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.