Package com.amazonaws.services.dynamodb.model

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


                result.getResponses() != null? result.getResponses() : Collections.<String, BatchResponse>emptyMap();
        for (String tableName : requestedTables) {
            List<Map<String, com.amazonaws.services.dynamodbv2.model.AttributeValue>> v2Items =
                    new ArrayList<Map<String, com.amazonaws.services.dynamodbv2.model.AttributeValue>>();

            BatchResponse v1Response = responses.get(tableName);
            if (v1Response != null) {
                for (Map<String, AttributeValue> v1Item : v1Response.getItems()) {
                    v2Items.add(MapV1ItemToV2(v1Item));
                }

                v2Capacities.add(
                        new com.amazonaws.services.dynamodbv2.model.ConsumedCapacity()
                                .withTableName(tableName)
                                .withCapacityUnits(v1Response.getConsumedCapacityUnits())
                );
            }
            v2Responses.put(tableName, v2Items);
        }
View Full Code Here


  public synchronized BatchGetItemResult batchGetItem(BatchGetItemRequest request) {
    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());
            Map<String, AttributeValue> item = this.tables.get(tableName).getItem(hashKeyValue, rangeKeyValue);
            item = getItemWithAttributesToGet(item, attributeToGet);
            if (item != null)
              items.add(item);
          } catch (NullPointerException e) {
            System.err.println("Caught NullPointerException: " + e.getMessage());
          }
        }
      } catch (NullPointerException e) {
        System.err.println("Caught NullPointerException: " + e.getMessage());
      }
      batchResponse.setConsumedCapacityUnits(1.0);
      if (items.size() != 0) {
        batchResponse.setItems(items);
        response.put(tableName, batchResponse);
        batchGetItemResult.setResponses(response);
        batchGetItemResult.getResponses().put(tableName, batchResponse);
      }
    }
View Full Code Here

            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, BatchResponse> responses = batchGetItemResult.getResponses();
            for (String tableName : responses.keySet()) {
                BatchResponse batchResponse = responses.get(tableName);
                List<Object> objects = null;
                if (resultSet.get(tableName) != null) {
                    objects = resultSet.get(tableName);
                } else {
                    objects = new LinkedList<Object>();
                }
                List<Map<String, AttributeValue>> items = batchResponse.getItems();
                for (Map<String, AttributeValue> item : items) {

                    objects.add(marshallIntoObject(tableNameToClassMapper.get(tableName), item));
                }
                resultSet.put(tableName, objects);
View Full Code Here

            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, BatchResponse> responses = batchGetItemResult.getResponses();
            for (String tableName : responses.keySet()) {
                BatchResponse batchResponse = responses.get(tableName);
                List<Object> objects = null;
                if (resultSet.get(tableName) != null) {
                    objects = resultSet.get(tableName);
                } else {
                    objects = new LinkedList<Object>();
                }
                List<Map<String, AttributeValue>> items = batchResponse.getItems();
                for (Map<String, AttributeValue> item : items) {

                    objects.add(marshallIntoObject(tableNameToClassMapper.get(tableName), item));
                }
                resultSet.put(tableName, objects);
View Full Code Here

            }

            batchGetItemResult = db.batchGetItem(batchGetItemRequest);
            Map<String, BatchResponse> responses = batchGetItemResult.getResponses();
            for (String tableName : responses.keySet()) {
                BatchResponse batchResponse = responses.get(tableName);
                List<Object> objects = null;
                if (resultSet.get(tableName) != null) {
                    objects = resultSet.get(tableName);
                } else {
                    objects = new LinkedList<Object>();
                }
                List<Map<String, AttributeValue>> items = batchResponse.getItems();
                for (Map<String, AttributeValue> item : items) {

                    objects.add(marshallIntoObject(tableNameToClassMapper.get(tableName), item));
                }
                resultSet.put(tableName, objects);
View Full Code Here

TOP

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

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.