Package org.opennms.netmgt.dao.mock
Class MockSessionUtils
- java.lang.Object
-
- org.opennms.netmgt.dao.mock.MockSessionUtils
-
- All Implemented Interfaces:
SessionUtils
public class MockSessionUtils extends Object implements SessionUtils
-
-
Constructor Summary
Constructors Constructor Description MockSessionUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> VwithManualFlush(java.util.function.Supplier<V> supplier)Converts the flush mode for the current session factory to MANUAL for the duration of the call to the given supplier.<V> VwithReadOnlyTransaction(java.util.function.Supplier<V> supplier)Invokes the given supplier within the context of a read-only transaction.<V> VwithTransaction(java.util.function.Supplier<V> supplier)Invoked the given supplier within the context of a transaction.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.dao.api.SessionUtils
withManualFlush, withReadOnlyTransaction, withTransaction
-
-
-
-
Method Detail
-
withTransaction
public <V> V withTransaction(java.util.function.Supplier<V> supplier)
Description copied from interface:SessionUtilsInvoked the given supplier within the context of a transaction.- Specified by:
withTransactionin interfaceSessionUtils- Type Parameters:
V- type returned by the supplier- Parameters:
supplier- supplier to invoke- Returns:
- value returned by the supplier
-
withReadOnlyTransaction
public <V> V withReadOnlyTransaction(java.util.function.Supplier<V> supplier)
Description copied from interface:SessionUtilsInvokes the given supplier within the context of a read-only transaction.- Specified by:
withReadOnlyTransactionin interfaceSessionUtils- Type Parameters:
V- type returned by the supplier- Parameters:
supplier- supplier to invoke- Returns:
- value returned by the supplier
-
withManualFlush
public <V> V withManualFlush(java.util.function.Supplier<V> supplier)
Description copied from interface:SessionUtilsConverts the flush mode for the current session factory to MANUAL for the duration of the call to the given supplier. The flush mode is reverted to it's previous value after the call.- Specified by:
withManualFlushin interfaceSessionUtils- Type Parameters:
V- type returned by the supplier- Parameters:
supplier- supplier to invoke- Returns:
- value returned by the supplier
-
-