in src/main/java/com/amazonaws/services/dynamodbv2/transactions/TransactionItem.java [515:542]
public void complete(final State expectedCurrentState) throws ConditionalCheckFailedException {
Map<String, ExpectedAttributeValue> expected = new HashMap<String, ExpectedAttributeValue>(2);
if(State.COMMITTED.equals(expectedCurrentState)) {
expected.put(AttributeName.STATE.toString(), new ExpectedAttributeValue(new AttributeValue(STATE_COMMITTED)));
} else if(State.ROLLED_BACK.equals(expectedCurrentState)) {
expected.put(AttributeName.STATE.toString(), new ExpectedAttributeValue(new AttributeValue(STATE_ROLLED_BACK)));
} else {
throw new TransactionAssertionException(txId, "Illegal state in finish(): " + expectedCurrentState + " txItem " + txItem);
}
Map<String, AttributeValueUpdate> updates = new HashMap<String, AttributeValueUpdate>();
updates.put(AttributeName.FINALIZED.toString(), new AttributeValueUpdate()
.withAction(AttributeAction.PUT)
.withValue(new AttributeValue(Transaction.BOOLEAN_TRUE_ATTR_VAL)));
updates.put(AttributeName.DATE.toString(), new AttributeValueUpdate()
.withAction(AttributeAction.PUT)
.withValue(txManager.getCurrentTimeAttribute()));
UpdateItemRequest completeRequest = new UpdateItemRequest()
.withTableName(txManager.getTransactionTableName())
.withKey(txKey)
.withAttributeUpdates(updates)
.withReturnValues(ReturnValue.ALL_NEW)
.withExpected(expected);
txItem = txManager.getClient().updateItem(completeRequest).getAttributes();
}