Examples of DeleteItemRequest


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

import com.fasterxml.jackson.core.JsonToken;

public class DeleteItemRequestJsonUnmarshaller implements Unmarshaller<DeleteItemRequest, JsonUnmarshallerContext> {

  public DeleteItemRequest unmarshall(JsonUnmarshallerContext context) throws Exception {
    DeleteItemRequest request = new DeleteItemRequest();

    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();

    while (true) {
      if (token == null) break;

      if (token == JsonToken.FIELD_NAME || token == JsonToken.START_OBJECT) {
        if (context.testExpression("TableName", targetDepth)) {
          context.nextToken();
          request.setTableName(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Key", targetDepth)) {
          request.setKey(KeyJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Expected", targetDepth)) {
          request.setExpected(new MapUnmarshaller<String, ExpectedAttributeValue>(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance(), ExpectedAttributeValueJsonUnmarshaller.getInstance()).unmarshall(context));
        }
        if (context.testExpression("ReturnValues", targetDepth)) {
          context.nextToken();
          request.setReturnValues(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == JsonToken.END_ARRAY || token == JsonToken.END_OBJECT) {
        if (context.getCurrentDepth() <= originalDepth) break;
      }
      token = context.nextToken();
View Full Code Here

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

                    break;
                }
            }
        }

        db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(key).withTableName(tableName).withExpected(expectedValues)));
    }
View Full Code Here

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

                    break;
                }
            }
        }

        db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(key).withTableName(tableName).withExpected(expectedValues)));
    }
View Full Code Here

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

        //Overlay any user provided expected values onto the generated ones
        if(deleteExpression != null && deleteExpression.getExpected() != null){
            expectedValues.putAll(deleteExpression.getExpected());
        }

        DeleteItemRequest req = applyUserAgent(new DeleteItemRequest()
            .withKey(key).withTableName(tableName)
            .withExpected(expectedValues))
            .withRequestMetricCollector(config.getRequestMetricCollector())
            ;
        db.deleteItem(req);
View Full Code Here

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

                    break;
                }
            }
        }

        DeleteItemRequest req = new DeleteItemRequest().withKey(key)
                .withTableName(tableName).withExpected(internalAssertions)
                .withRequestMetricCollector(config.getRequestMetricCollector());

        if (deleteExpression != null) {
            String conditionalExpression = deleteExpression.getConditionExpression();

            if (conditionalExpression != null) {
                if (internalAssertions != null && !internalAssertions.isEmpty()) {
                    throw new AmazonClientException(
                            "Condition Expressions cannot be used if a versioned attribute is present");
                }

                req = req
                        .withConditionExpression(conditionalExpression)
                        .withExpressionAttributeNames(
                                deleteExpression.getExpressionAttributeNames())
                        .withExpressionAttributeValues(
                                deleteExpression.getExpressionAttributeValues());
            }

            req = req.withExpected(
                    mergeExpectedAttributeValueConditions(internalAssertions,
                            deleteExpression.getExpected(),
                            deleteExpression.getConditionalOperator()))
                    .withConditionalOperator(
                            deleteExpression.getConditionalOperator());
View Full Code Here

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

    private String conditionExpression;
    private Map<String, String> nameMap;
    private Map<String, Object> valueMap;

    public DeleteItemSpec() {
        super(new DeleteItemRequest());
    }
View Full Code Here

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

        //Overlay any user provided expected values onto the generated ones
        if(deleteExpression != null && deleteExpression.getExpected() != null){
            expectedValues.putAll(deleteExpression.getExpected());
        }

        db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(key).withTableName(tableName).withExpected(expectedValues)));
    }
View Full Code Here

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

                    break;
                }
            }
        }

        db.deleteItem(applyUserAgent(new DeleteItemRequest().withKey(key).withTableName(tableName).withExpected(expectedValues)));
    }
View Full Code Here

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

        List<T> allLeases = listLeases();

        LOG.warn("Deleting " + allLeases.size() + " items from table " + table);

        for (T lease : allLeases) {
            DeleteItemRequest deleteRequest = new DeleteItemRequest();
            deleteRequest.setTableName(table);
            deleteRequest.setKey(serializer.getDynamoHashKey(lease));

            dynamoDBClient.deleteItem(deleteRequest);
        }
    }
View Full Code Here

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

        if (LOG.isDebugEnabled()) {
            LOG.debug(String.format("Deleting lease with shardId %s", lease.getLeaseKey()));
        }

        DeleteItemRequest deleteRequest = new DeleteItemRequest();
        deleteRequest.setTableName(table);
        deleteRequest.setKey(serializer.getDynamoHashKey(lease));

        try {
            dynamoDBClient.deleteItem(deleteRequest);
        } catch (AmazonClientException e) {
            throw convertAndRethrowExceptions("delete", lease.getLeaseKey(), e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.