Java Code Examples for com.amazonaws.services.dynamodbv2.document.DeleteItemOutcome

The following examples show how to use com.amazonaws.services.dynamodbv2.document.DeleteItemOutcome. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private static void deleteItem() {

        Table table = dynamoDB.getTable(tableName);

        try {

            DeleteItemSpec deleteItemSpec = new DeleteItemSpec().withPrimaryKey("Id", 120)
                .withConditionExpression("#ip = :val").withNameMap(new NameMap().with("#ip", "InPublication"))
                .withValueMap(new ValueMap().withBoolean(":val", false)).withReturnValues(ReturnValue.ALL_OLD);

            DeleteItemOutcome outcome = table.deleteItem(deleteItemSpec);

            // Check the response.
            System.out.println("Printing item that was deleted...");
            System.out.println(outcome.getItem().toJSONPretty());

        }
        catch (Exception e) {
            System.err.println("Error deleting item in " + tableName);
            System.err.println(e.getMessage());
        }
    }
 
Example 2
private static void deleteItem() {

        Table table = dynamoDB.getTable(tableName);

        try {

            DeleteItemSpec deleteItemSpec = new DeleteItemSpec()
            .withPrimaryKey("Id", 120)
            .withConditionExpression("#ip = :val")
            .withNameMap(new NameMap()
                .with("#ip", "InPublication"))
            .withValueMap(new ValueMap()
            .withBoolean(":val", false))
            .withReturnValues(ReturnValue.ALL_OLD);

            DeleteItemOutcome outcome = table.deleteItem(deleteItemSpec);

            // Check the response.
            System.out.println("Printing item that was deleted...");
            System.out.println(outcome.getItem().toJSONPretty());

        } catch (Exception e) {
            System.err.println("Error deleting item in " + tableName);
            System.err.println(e.getMessage());
        }
    }
 
Example 3
@Override
public void remove(String installedAppId) {
    Table table = dynamoDB.getTable(tableName);
    DeleteItemOutcome outcome = table.deleteItem("installedAppId", installedAppId);
    if (log.isDebugEnabled()) {
        log.debug("deleted item outcome: " + outcome);
    }
}
 
Example 4
Source Project: serverless   Source File: BookDelete.java    License: Apache License 2.0 3 votes vote down vote up
@Override
public String handleRequest(Book request, Context context) {
    
	DeleteItemOutcome outcome = DynamoDBUtil.getTable().deleteItem(new PrimaryKey("id", request.getId()));
	
	String result = "Item deleted: " + outcome.getDeleteItemResult().getSdkHttpMetadata().getHttpStatusCode();
	
	return result;
}