1 package eu
.etaxonomy
.cdm
.api
.conversation
;
3 import javax
.sql
.DataSource
;
5 import org
.hibernate
.Session
;
6 import org
.hibernate
.SessionFactory
;
7 import org
.springframework
.transaction
.PlatformTransactionManager
;
8 import org
.springframework
.transaction
.TransactionStatus
;
10 public class ConversationHolderMock
extends ConversationHolder
{
13 public ConversationHolderMock() {
17 * This method has to be called when starting a new unit-of-work. All required resources are
18 * bound so that SessionFactory.getCurrentSession() returns the right session for this conversation
24 // public SessionHolder getSessionHolder(){
31 // private DataSource getDataSource() {
36 // * @return true if this longSession is bound to the session factory.
38 // public boolean isBound(){
43 * Creates an instance of TransactionStatus and binds it to this conversation manager.
44 * At the moment we allow only on transaction per conversation holder.
46 * @return the transaction status bound to this conversation holder
48 public TransactionStatus
startTransaction(){
53 // * @return if there is a running transaction
55 // public boolean isTransactionActive(){
60 // * @see org.hibernate.Session#evict(java.lang.Object object)
62 // public void evict(Object object){
67 // * @see org.hibernate.Session#refresh(java.lang.Object object)
69 // public void refresh(Object object){
74 // * @see org.hibernate.Session#clear()
76 // public void clear(){
81 * Commit the running transaction.
88 * Commit the running transaction but optionally start a
91 * @param restartTransaction whether to start a new transaction
93 public TransactionStatus
commit(boolean restartTransaction
){
98 * @return the session associated with this conversation manager
100 public Session
getSession() {
105 // * @return the session factory that is bound to this conversation manager
107 // private SessionFactory getSessionFactory() {
111 // public void delete(Object object){
116 // * Facades Session.lock()
118 // public void lock(Object persistentObject, LockMode lockMode) {
122 // public void lock(String entityName, Object persistentObject, LockMode lockMode){
123 // getSession().lock(entityName, persistentObject, lockMode);
127 // * @return the definition
129 // public TransactionDefinition getDefinition() {
134 // * @param definition the definition to set
136 // public void setDefinition(TransactionDefinition definition) {
141 // * Register to get updated after any interaction with the datastore
143 // public void registerForDataStoreChanges(IConversationEnabled observer) {
148 // * Register to get updated after any interaction with the datastore
150 // public void unregisterForDataStoreChanges(IConversationEnabled observer) {
155 * Free resources bound to this conversationHolder
161 // public boolean isClosed(){