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> V
withManualFlush(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> V
withReadOnlyTransaction(java.util.function.Supplier<V> supplier)
Invokes the given supplier within the context of a read-only transaction.<V> V
withTransaction(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:SessionUtils
Invoked the given supplier within the context of a transaction.- Specified by:
withTransaction
in 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:SessionUtils
Invokes the given supplier within the context of a read-only transaction.- Specified by:
withReadOnlyTransaction
in 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:SessionUtils
Converts 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:
withManualFlush
in interfaceSessionUtils
- Type Parameters:
V
- type returned by the supplier- Parameters:
supplier
- supplier to invoke- Returns:
- value returned by the supplier
-
-