Project

General

Profile

Download (4.01 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.taxeditor.model;
2

    
3
import javax.sql.DataSource;
4

    
5
import org.hibernate.FlushMode;
6
import org.hibernate.LockMode;
7
import org.hibernate.Session;
8
import org.hibernate.SessionFactory;
9
import org.springframework.orm.hibernate3.SessionFactoryUtils;
10
import org.springframework.orm.hibernate3.SessionHolder;
11
import org.springframework.transaction.PlatformTransactionManager;
12
import org.springframework.transaction.TransactionDefinition;
13
import org.springframework.transaction.TransactionStatus;
14
import org.springframework.transaction.support.TransactionSynchronizationManager;
15

    
16
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
17
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
18
import eu.etaxonomy.cdm.persistence.hibernate.CdmPostDataChangeObservableListener;
19

    
20
public class ConversationHolderMock extends ConversationHolder {
21

    
22

    
23
	/**
24
	 * This method has to be called when starting a new unit-of-work. All required resources are
25
	 * bound so that SessionFactory.getCurrentSession() returns the right session for this conversation
26
	 */
27
	public void bind() {
28
		
29
	}
30
//	
31
//	public SessionHolder getSessionHolder(){
32
//		return null;
33
//	}
34
//	
35
//	/**
36
//	 * @return
37
//	 */
38
//	private DataSource getDataSource() {
39
//		return null;
40
//	}
41
//
42
//	/**
43
//	 * @return true if this longSession is bound to the session factory.
44
//	 */
45
//	public boolean isBound(){
46
//		return false;
47
//	}
48
//	
49
	/**
50
	 * Creates an instance of TransactionStatus and binds it to this conversation manager.
51
	 * At the moment we allow only on transaction per conversation holder.
52
	 * 
53
	 * @return the transaction status bound to this conversation holder
54
	 */
55
	public TransactionStatus startTransaction(){
56
		return null;
57
	}
58
//	
59
//	/** 
60
//	 * @return if there is a running transaction
61
//	 */
62
//	public boolean isTransactionActive(){
63
//		return false;
64
//	}
65
//	
66
//	/* (non-Javadoc)
67
//	 * @see org.hibernate.Session#evict(java.lang.Object object)
68
//	 */
69
//	public void evict(Object object){
70
//
71
//	}
72
//	
73
//	/* (non-Javadoc)
74
//	 * @see org.hibernate.Session#refresh(java.lang.Object object)
75
//	 */
76
//	public void refresh(Object object){
77
//		
78
//	}
79
//	
80
//	/* (non-Javadoc)
81
//	 * @see org.hibernate.Session#clear()
82
//	 */
83
//	public void clear(){
84
//		
85
//	}
86
//	
87
	/**
88
	 * Commit the running transaction.
89
	 */
90
	public void commit(){
91
		
92
	}
93
	
94
	/**
95
	 * Commit the running transaction but optionally start a
96
	 * new one right away.
97
	 * 
98
	 * @param restartTransaction whether to start a new transaction
99
	 */
100
	public TransactionStatus commit(boolean restartTransaction){
101
		return null;
102
	}
103

    
104
	/**
105
	 * @return the session associated with this conversation manager 
106
	 */
107
	private Session getSession() {
108
		return null;
109
	}
110
//	
111
//	/** 
112
//	 * @return the session factory that is bound to this conversation manager
113
//	 */
114
//	private SessionFactory getSessionFactory() {
115
//		return null;
116
//	}
117
//
118
//	public void delete(Object object){
119
//
120
//	}
121
//	
122
//	/**
123
//	 * Facades Session.lock()
124
//	 */
125
//	public void lock(Object persistentObject, LockMode lockMode) {
126
//		
127
//	}
128
//	
129
//	public void lock(String entityName, Object persistentObject, LockMode lockMode){
130
//		getSession().lock(entityName, persistentObject, lockMode);
131
//	}
132
//
133
//	/**
134
//	 * @return the definition
135
//	 */
136
//	public TransactionDefinition getDefinition() {
137
//		return null;
138
//	}
139
//
140
//	/**
141
//	 * @param definition the definition to set
142
//	 */
143
//	public void setDefinition(TransactionDefinition definition) {
144
//
145
//	}
146
//	
147
//	/**
148
//	 * Register to get updated after any interaction with the datastore
149
//	 */
150
//	public void registerForDataStoreChanges(IConversationEnabled observer) {
151
//
152
//	}
153
//	
154
//	/**
155
//	 * Register to get updated after any interaction with the datastore
156
//	 */
157
//	public void unregisterForDataStoreChanges(IConversationEnabled observer) {
158
//		
159
//	}
160
//	
161
	/**
162
	 * Free resources bound to this conversationHolder
163
	 */
164
	public void close(){
165

    
166
	}
167
//	
168
//	public boolean isClosed(){
169
//		return false;
170
//	}
171

    
172
}
(8-8/31)