Package com.amazonaws.services.dynamodb.model

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


  public synchronized BatchWriteItemResult batchWriteItem(BatchWriteItemRequest request) {
    BatchWriteItemResult batchWriteItemResult = new BatchWriteItemResult();
    HashMap<String, BatchWriteResponse> responses = new HashMap<String, BatchWriteResponse>();
    for (String tableName : request.getRequestItems().keySet()) {
      BatchWriteResponse batchWriteResponse = new BatchWriteResponse();
      List<WriteRequest> writeRequests = request.getRequestItems().get(tableName);
      for (WriteRequest writeRequest : writeRequests) {
        PutRequest putRequest = writeRequest.getPutRequest();
        if (putRequest != null) {
          this.tables.get(tableName).putItem(putRequest.getItem());
        }
        DeleteRequest deleteRequest = writeRequest.getDeleteRequest();
        if (deleteRequest != null) {
          Key key = deleteRequest.getKey();
          if (key != null) {
            this.tables.get(tableName).removeItem(key.getHashKeyElement().getS());
          }
        }
      }
      batchWriteResponse.setConsumedCapacityUnits(1.0);
      responses.put(tableName, batchWriteResponse);
    }
        batchWriteItemResult.setResponses(responses);
        batchWriteItemResult.setUnprocessedItems(new HashMap<String, List<WriteRequest>>());
    return batchWriteItemResult;
View Full Code Here

TOP

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

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.