Package com.amazonaws.services.dynamodb.model

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


    public void deleteItem() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        AttributeValue hash = new AttributeValue("ad"); //createStringAttribute();
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash)));
        DeleteItemRequest request = new DeleteItemRequest().withTableName(tableName).withKey(new Key(hash));
        DeleteItemResult result = getClient().deleteItem(request);
        Assert.assertNotNull(result.getConsumedCapacityUnits());
    }
View Full Code Here

        AttributeValue range2 = new AttributeValue().withN("2");
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash, range1)));
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash, range2)));
        Key key1 = new Key().withHashKeyElement(hash).withRangeKeyElement(range1);
        Key key2 = new Key().withHashKeyElement(hash).withRangeKeyElement(range2);
        DeleteItemRequest request1 = new DeleteItemRequest().withTableName(tableName).withKey(key1).withReturnValues(ReturnValue.ALL_OLD);
        DeleteItemRequest request2 = new DeleteItemRequest().withTableName(tableName).withKey(key2).withReturnValues(ReturnValue.ALL_OLD);
        DeleteItemResult result = getClient().deleteItem(request1);
        Assert.assertNotNull(result.getAttributes());
        result = getClient().deleteItem(request2);
        Assert.assertNotNull(result.getAttributes());
    }
View Full Code Here

    public void deleteItemWithoutTableName() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        AttributeValue hash = createStringAttribute();
        getClient().putItem(new PutItemRequest().withTableName(tableName).withItem(createGenericItem(hash)));
        DeleteItemRequest request = new DeleteItemRequest().withKey(new Key(hash));
    try {
      getClient().deleteItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

    @Test
    public void deleteNonExistantItem() {
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
        DeleteItemRequest request = new DeleteItemRequest().withTableName(tableName).withKey(new Key(createStringAttribute()));
    try {
      getClient().deleteItem(request);
      Assert.assertTrue(false);// Should have thrown an exception
    } catch (AmazonServiceException ase) {
    }
View Full Code Here

                    break;
                }
            }
        }

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

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

                    break;
                }
            }
        }

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

                    break;
                }
            }
        }

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

TOP

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

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.