public Order deleteOrder()

in src/main/java/com/amazonaws/dao/OrderDao.java [205:226]


    public Order deleteOrder(final String orderId) {
        final DeleteItemResponse result;
        try {
            return Optional.ofNullable(dynamoDb.deleteItem(DeleteItemRequest.builder()
                            .tableName(tableName)
                            .key(Collections.singletonMap(ORDER_ID,
                                    AttributeValue.builder().s(orderId).build()))
                            .conditionExpression("attribute_exists(orderId)")
                            .returnValues(ReturnValue.ALL_OLD)
                            .build()))
                    .map(DeleteItemResponse::attributes)
                    .map(this::convert)
                    .orElseThrow(() -> new IllegalStateException(
                            "Condition passed but deleted item was null"));
        } catch (ConditionalCheckFailedException e) {
            throw new UnableToDeleteException(
                    "A competing request changed the order while processing this request");
        } catch (ResourceNotFoundException e) {
            throw new TableDoesNotExistException("Order table " + tableName
                    + " does not exist and was deleted after reading the order");
        }
    }