use of com.amazonaws.services.dynamodbv2.document.DeleteItemOutcome in project aws-doc-sdk-examples by awsdocs.
the class DocumentAPIItemCRUDExample method deleteItem.
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());
}
}
Aggregations