|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.schwarzrot.data.transaction.ApplicationTransaction
public class ApplicationTransaction
An ApplicationTransaction
is a wrapper around
TransactionalOperation
s, which can be added to setup a transaction.
The transaction is then executed by the Repository
and so the
transaction may span different persistent resources, but the application does
not need to care about those resources nor does it need to know, which
resource is involved.
The application only adds an Entity
or several entities together with
the opcode, which should be applied to that entities.
So, the enlisting/delisting of resources is internal to the transaction
processor, which in this case is the Repository
.
This transaction implements a VetoableChangeSupport
for changes of
the transaction status. These status values are vetoable:
Constructor Summary | |
---|---|
ApplicationTransaction()
|
Method Summary | |
---|---|
void |
add(TransactionalOperation<?> tao)
used to add an operation to the transaction. |
void |
addVetoableStatusListener(VetoableChangeListener listener)
add vetoable change listener to the transaction. |
void |
execute()
executes all added operations |
TransactionalOperation.DataDirection |
getDataDirection()
internal use only. |
List<TransactionalOperation<?>> |
getOperations()
internal use only. |
TransactionResource<?> |
getResource(EntityManager em)
internal use only. |
TransactionStatus |
getStatus()
accessor to the transactions status |
boolean |
isEntityManagerRegistered(EntityManager em)
internal use only. |
boolean |
isRollbackOnly()
internal use only. |
Collection<EntityManager> |
registeredManagers()
internal use only. |
void |
registerResource(EntityManager em,
TransactionResource<?> res)
internal use only. |
void |
setRollbackOnly()
use this, if the transaction does only read operations. |
void |
setStatus(TransactionStatus ts)
internal use only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApplicationTransaction()
Method Detail |
---|
public void add(TransactionalOperation<?> tao)
Transaction
add
in interface Transaction
tao
- the operation to add to the transactionpublic void addVetoableStatusListener(VetoableChangeListener listener)
Transaction
addVetoableStatusListener
in interface Transaction
listener
- - the listener to addpublic void execute()
Transaction
execute
in interface Transaction
public TransactionalOperation.DataDirection getDataDirection()
Transaction
EntityManager
to open
the TransactionResource
in an appropriate way.
getDataDirection
in interface Transaction
public List<TransactionalOperation<?>> getOperations()
Transaction
Repository
getOperations
in interface Transaction
public TransactionResource<?> getResource(EntityManager em)
Transaction
Repository
getResource
in interface Transaction
em
- the EntityManager
, that created that resource
TransactionResource
public TransactionStatus getStatus()
Transaction
getStatus
in interface Transaction
public boolean isEntityManagerRegistered(EntityManager em)
Transaction
Repository
isEntityManagerRegistered
in interface Transaction
em
- the EntityManager
of interest
EntityManager
has been used in a previous
operation, otherwise falsepublic boolean isRollbackOnly()
Transaction
Repository
isRollbackOnly
in interface Transaction
public Collection<EntityManager> registeredManagers()
Transaction
Repository
registeredManagers
in interface Transaction
EntityManager
spublic void registerResource(EntityManager em, TransactionResource<?> res)
Transaction
Repository
registerResource
in interface Transaction
em
- the EntityManager
, that created the
TransactionResource
res
- the created TransactionResource
public void setRollbackOnly()
Transaction
Entity
setRollbackOnly
in interface Transaction
public void setStatus(TransactionStatus ts) throws PropertyVetoException
Transaction
Repository
setStatus
in interface Transaction
ts
- the new status
PropertyVetoException
|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |