Package com.amazonaws.services.dynamodb.model

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


        List<Key> v1Keys = new ArrayList<Key>();
        for (Map<String, com.amazonaws.services.dynamodbv2.model.AttributeValue> v2Key : v2KeysAndAttr.getKeys()) {
            v1Keys.add(MapV2KeyToV1(v2Key, table));
        }
        KeysAndAttributes v1KeysAndAttr =
            new KeysAndAttributes()
                .withAttributesToGet(v2KeysAndAttr.getAttributesToGet())
                .withConsistentRead(v2KeysAndAttr.getConsistentRead())
                .withKeys(v1Keys)
                ;
        return v1KeysAndAttr;
View Full Code Here


            Map<String, Table> tables) {

        Map<String, KeysAndAttributes> v1RequestItems = new HashMap<String, KeysAndAttributes>();
        for (String tableName : v2Request.getRequestItems().keySet()) {
            Table table = tables.get(tableName);
            KeysAndAttributes v1RequestItem = MapV2KeysAndAttributesToV1(v2Request.getRequestItems().get(tableName), table);
            v1RequestItems.put(tableName, v1RequestItem);
        }

        BatchGetItemRequest request =
            new BatchGetItemRequest()
View Full Code Here

        Map<String, KeysAndAttributes> v1UnprocessedKeys = result.getUnprocessedKeys();
        if (v1UnprocessedKeys != null) {
            v2UnprocessedKeys = new HashMap<String, com.amazonaws.services.dynamodbv2.model.KeysAndAttributes>();
            for (String tableName : v1UnprocessedKeys.keySet()) {
                Table table = tables.get(tableName);
                KeysAndAttributes v1KeysAndAttr = result.getUnprocessedKeys().get(tableName);
                v2UnprocessedKeys.put(tableName, MapV1KeysAndAttributesToV2(
                        v1KeysAndAttr, table));
            }
        }
View Full Code Here

        return KeysAndAttributes.class.isAssignableFrom(clazz);

    }

    public List<Error> validate(Object target) {
        KeysAndAttributes instance = (KeysAndAttributes) target;
        List<Error> errors = new ArrayList<Error>();
      // TODO: Make sure this works
        for (Key key : instance.getKeys()) {
            errors.addAll(ValidatorUtils.invokeValidator(new KeyValidator(), key));
        }
        return removeNulls(errors);
    }
View Full Code Here

    BatchGetItemResult batchGetItemResult = new BatchGetItemResult();
    Map<String, BatchResponse> response = new HashMap<String, BatchResponse>();
    for (String tableName : request.getRequestItems().keySet()) {
      BatchResponse batchResponse = new BatchResponse();
      List<Map<String, AttributeValue>> items = new ArrayList<Map<String, AttributeValue>>();
      KeysAndAttributes keysAndAttributes = request.getRequestItems().get(tableName);
      List<Key> itemKeys = keysAndAttributes.getKeys();
      List<String> attributeToGet = keysAndAttributes.getAttributesToGet();
      try {
        for (Key itemKey : itemKeys) {
          try {
                        String hashKeyValue = getKeyValue(itemKey.getHashKeyElement());
                        String rangeKeyValue = getKeyValue(itemKey.getRangeKeyElement());
View Full Code Here

  @Test
  public void vanillaBatchGetItemTest() throws Exception {
        this.vanillaBatchWriteItemTest();
        BatchGetItemRequest batchGetItemRequest = new BatchGetItemRequest();
        Map<String, KeysAndAttributes> requestItems = new HashMap<String, KeysAndAttributes>();
        KeysAndAttributes keysAndAttributes = new KeysAndAttributes();
        List<String> attributesToGet = new ArrayList<String>();
        attributesToGet.add(hashKeyValue1);
        keysAndAttributes.setAttributesToGet(attributesToGet);
        List<Key> keys = new ArrayList<Key>();

        KeysAndAttributes keysAndAttributes1 = new KeysAndAttributes();
        List<String> attributesToGet1 = new ArrayList<String>();
        attributesToGet1.add(hashKeyValue2);
        keysAndAttributes1.setAttributesToGet(attributesToGet1);
        //Test case 1: Every request has matches.
//        keys.add(new Key(new AttributeValue("4")));
//        keys.add(new Key(new AttributeValue("5")));
//        keys.add(new Key(new AttributeValue("3")));

        //Test case 2: Requests has no match.
        keys.add(new Key(new AttributeValue("1")));

        //Test case 3: Complicated test, some requests has matches, some doesn't.
//        keys.add(new Key(new AttributeValue("7")));
//        keys.add(new Key(new AttributeValue("4")));

        //Test case 4: Duplicated request
        //Duplicated requests return duplicated results.
//        keys.add(new Key(new AttributeValue("7")));
//        keys.add(new Key(new AttributeValue("7")));
//        keys.add(new Key(new AttributeValue("4")));
//        keys.add(new Key(new AttributeValue("4")));

        keysAndAttributes.setKeys(keys);
        keysAndAttributes1.setKeys(keys);
        //Test case for Exception: Table doesn't exist.
//        requestItems.put("Vito's Table", keysAndAttributes);

        // Normal test
        // TODO: Multi table test failed. Need to be fixed.
View Full Code Here

                }

                if ( !requestItems.containsKey(tableName) ) {
                    requestItems
                            .put(tableName,
                                    new KeysAndAttributes().withConsistentRead(consistentReads).withKeys(
                                            new LinkedList<Key>()));
                }

                requestItems.get(tableName).getKeys()
                        .add(new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement));
View Full Code Here

                }

                if ( !requestItems.containsKey(tableName) ) {
                    requestItems
                            .put(tableName,
                                    new KeysAndAttributes().withConsistentRead(consistentReads).withKeys(
                                            new LinkedList<Key>()));
                }

                requestItems.get(tableName).getKeys()
                        .add(new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement));
View Full Code Here

                }

                if ( !requestItems.containsKey(tableName) ) {
                    requestItems
                            .put(tableName,
                                    new KeysAndAttributes().withConsistentRead(consistentReads).withKeys(
                                            new LinkedList<Key>()));
                }

                requestItems.get(tableName).getKeys()
                        .add(new Key().withHashKeyElement(hashKeyElement).withRangeKeyElement(rangeKeyElement));
View Full Code Here

TOP

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

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.