edu.internet2.middleware.grouper.hibernate
Class GrouperTransaction

java.lang.Object
  extended by edu.internet2.middleware.grouper.hibernate.GrouperTransaction

public class GrouperTransaction
extends Object

Use this class to make a transaction around grouper operations (can also use HibernateSession, thoguh if hib it will throw exceptions)

Author:
mchyzer

Constructor Summary
GrouperTransaction()
           
 
Method Summary
 Object _internal_getPayload()
          the dao can store some state here
 void _internal_setPayload(Object payload)
          the dao can store some state here
static Object callbackGrouperTransaction(GrouperTransactionHandler grouperTransactionHandler)
          call this to establish a transaction demarcation for the GrouperTransactionHandler business logic.
static Object callbackGrouperTransaction(GrouperTransactionType grouperTransactionType, GrouperTransactionHandler grouperTransactionHandler)
          call this to establish a transaction demarcation for the GrouperTransactionHandler business logic
 boolean commit(GrouperCommitType grouperCommitType)
          commit a transaction (perhaps, based on type)
 boolean isCachingEnabled()
          provide ability to turn off all caching for this session
 boolean isTransactionActive()
          see if a transaction has an open transaction (that hasnt been committed or rolled back yet)
 boolean rollback(GrouperRollbackType grouperRollbackType)
          rollback a transaction (perhaps, based on type)
 void setCachingEnabled(boolean enabledCaching1)
          provide ability to turn off all caching for this session
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrouperTransaction

public GrouperTransaction()
Method Detail

isCachingEnabled

public boolean isCachingEnabled()
provide ability to turn off all caching for this session

Returns:
the enabledCaching

setCachingEnabled

public void setCachingEnabled(boolean enabledCaching1)
provide ability to turn off all caching for this session

Parameters:
enabledCaching1 - the enabledCaching to set

_internal_getPayload

public Object _internal_getPayload()
the dao can store some state here

Returns:
the payload

_internal_setPayload

public void _internal_setPayload(Object payload)
the dao can store some state here

Parameters:
payload - the payload to set

callbackGrouperTransaction

public static Object callbackGrouperTransaction(GrouperTransactionType grouperTransactionType,
                                                GrouperTransactionHandler grouperTransactionHandler)
call this to establish a transaction demarcation for the GrouperTransactionHandler business logic

Parameters:
grouperTransactionType - is enum of how the transaction should work.
grouperTransactionHandler - will get the callback
Returns:
the object returned from the callback
Throws:
RuntimeException - if something wrong inside, not sure which exceptions... its whatever your methods throw

callbackGrouperTransaction

public static Object callbackGrouperTransaction(GrouperTransactionHandler grouperTransactionHandler)
call this to establish a transaction demarcation for the GrouperTransactionHandler business logic. The transaction type will be READ_WRITE_OR_USE_EXISTING (this is the default since probably is what is wanted).

Parameters:
grouperTransactionHandler - will get the callback
Returns:
the object returned from the callback
Throws:
RuntimeException - if something wrong inside, not sure which exceptions... its whatever your methods throw

commit

public boolean commit(GrouperCommitType grouperCommitType)
commit a transaction (perhaps, based on type)

Parameters:
grouperCommitType -
Returns:
if the tx committed

rollback

public boolean rollback(GrouperRollbackType grouperRollbackType)
rollback a transaction (perhaps, based on type)

Parameters:
grouperRollbackType -
Returns:
if the tx rolled back

isTransactionActive

public boolean isTransactionActive()
see if a transaction has an open transaction (that hasnt been committed or rolled back yet)

Returns:
true if transaction exists and active (not committed or rolled back)