public class DefaultCompensationContext extends Object implements CompensationContext
| Constructor and Description |
|---|
DefaultCompensationContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
resetCompensation()
Signify that the command does not need the compensation data which has been recorded up to this point, and if an
error occurs after this point then compensation will handle only the entities which were snapshot after this
point.
|
void |
setBusinessEntitySnapshotDAO(BusinessEntitySnapshotDAO businessEntitySnapshotDAO) |
void |
setCommandId(Guid commandId) |
void |
setCommandType(String commandType) |
void |
setSnapshotSerializer(Serializer snapshotSerializer) |
void |
snapshotEntity(BusinessEntity<?> entity)
Save a snapshot of the entire entity before it is changed/deleted in the DB, so that it can be restored later on
in case of compensation.
|
void |
snapshotEntityStatus(BusinessEntity<?> entity,
Enum<?> status)
Snapshot the entity status only, so that in case of compensation for the entity, the status will be updated to
it's original value.
|
void |
snapshotNewEntity(BusinessEntity<?> entity)
Save a snapshot of a new entity that was added to the DB, so that if there's need for compensation it will be
deleted from the DB.
|
void |
stateChanged()
Signify that the command state had changed and the transaction is about to end, so that the snapshots can
be saved to the DB (in order to reduce lock time on the compensations table).
|
public void setSnapshotSerializer(Serializer snapshotSerializer)
snapshotSerializer - the snapshotSerializer to setpublic void setBusinessEntitySnapshotDAO(BusinessEntitySnapshotDAO businessEntitySnapshotDAO)
businessEntitySnapshotDAO - the businessEntitySnapshotDAO to setpublic void setCommandId(Guid commandId)
commandId - the commandId to setpublic void setCommandType(String commandType)
commandType - the commandType to setpublic void snapshotEntity(BusinessEntity<?> entity)
CompensationContextsnapshotEntity in interface CompensationContextentity - The entity state before the change.public void snapshotNewEntity(BusinessEntity<?> entity)
CompensationContextsnapshotNewEntity in interface CompensationContextentity - The new entity which was added.public void snapshotEntityStatus(BusinessEntity<?> entity, Enum<?> status)
CompensationContextsnapshotEntityStatus in interface CompensationContextentity - The entity for which to save the status snapshot.status - The status to snapshot.public void stateChanged()
CompensationContextstateChanged in interface CompensationContextpublic void resetCompensation()
CompensationContextresetCompensation in interface CompensationContextCopyright © 2012. All Rights Reserved.