1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2013 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.editor.view.dataimport.transientServices;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import org.springframework.security.authentication.ProviderManager;
|
15
|
import org.springframework.transaction.PlatformTransactionManager;
|
16
|
import org.springframework.transaction.TransactionStatus;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
|
19
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
20
|
import eu.etaxonomy.cdm.api.service.IAgentService;
|
21
|
import eu.etaxonomy.cdm.api.service.IClassificationService;
|
22
|
import eu.etaxonomy.cdm.api.service.ICollectionService;
|
23
|
import eu.etaxonomy.cdm.api.service.ICommonService;
|
24
|
import eu.etaxonomy.cdm.api.service.IDatabaseService;
|
25
|
import eu.etaxonomy.cdm.api.service.IDescriptionService;
|
26
|
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
|
27
|
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
|
28
|
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
|
29
|
import eu.etaxonomy.cdm.api.service.IGroupService;
|
30
|
import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;
|
31
|
import eu.etaxonomy.cdm.api.service.ILocationService;
|
32
|
import eu.etaxonomy.cdm.api.service.IMediaService;
|
33
|
import eu.etaxonomy.cdm.api.service.INameService;
|
34
|
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
|
35
|
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
|
36
|
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
|
37
|
import eu.etaxonomy.cdm.api.service.IReferenceService;
|
38
|
import eu.etaxonomy.cdm.api.service.IService;
|
39
|
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
|
40
|
import eu.etaxonomy.cdm.api.service.ITaxonService;
|
41
|
import eu.etaxonomy.cdm.api.service.ITermService;
|
42
|
import eu.etaxonomy.cdm.api.service.IUserService;
|
43
|
import eu.etaxonomy.cdm.api.service.IVocabularyService;
|
44
|
import eu.etaxonomy.cdm.api.service.IWorkingSetService;
|
45
|
import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;
|
46
|
import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;
|
47
|
import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
|
48
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
49
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
50
|
import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;
|
51
|
|
52
|
/**
|
53
|
* @author pplitzner
|
54
|
* @date 26.09.2013
|
55
|
*
|
56
|
*/
|
57
|
public class TransientCdmRepository implements ICdmApplicationConfiguration {
|
58
|
|
59
|
private final ICdmApplicationConfiguration defaultApplicationConfiguration;
|
60
|
private TransientOccurenceService occurenceService;
|
61
|
|
62
|
public Collection<SpecimenOrObservationBase<?>> getUnits(){
|
63
|
return occurenceService.getUnits();
|
64
|
}
|
65
|
|
66
|
/**
|
67
|
* @param defaultApplicationConfiguration
|
68
|
*/
|
69
|
public TransientCdmRepository(ICdmApplicationConfiguration defaultApplicationConfiguration) {
|
70
|
this.defaultApplicationConfiguration = defaultApplicationConfiguration;
|
71
|
this.occurenceService = (TransientOccurenceService) getOccurrenceService();
|
72
|
}
|
73
|
|
74
|
/**
|
75
|
* @return
|
76
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#NewConversation()
|
77
|
*/
|
78
|
@Override
|
79
|
public ConversationHolder NewConversation() {
|
80
|
return defaultApplicationConfiguration.NewConversation();
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* @param arg0
|
85
|
* @param arg1
|
86
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#authenticate(java.lang.String, java.lang.String)
|
87
|
*/
|
88
|
@Override
|
89
|
public void authenticate(String arg0, String arg1) {
|
90
|
defaultApplicationConfiguration.authenticate(arg0, arg1);
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* @param arg0
|
95
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#commitTransaction(org.springframework.transaction.TransactionStatus)
|
96
|
*/
|
97
|
@Override
|
98
|
public void commitTransaction(TransactionStatus arg0) {
|
99
|
defaultApplicationConfiguration.commitTransaction(arg0);
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* @return
|
104
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAgentService()
|
105
|
*/
|
106
|
@Override
|
107
|
public IAgentService getAgentService() {
|
108
|
return new TransientAgentService(defaultApplicationConfiguration.getAgentService());
|
109
|
}
|
110
|
|
111
|
/**
|
112
|
* @return
|
113
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAuthenticationManager()
|
114
|
*/
|
115
|
@Override
|
116
|
public ProviderManager getAuthenticationManager() {
|
117
|
return defaultApplicationConfiguration.getAuthenticationManager();
|
118
|
}
|
119
|
|
120
|
/**
|
121
|
* @param arg0
|
122
|
* @return
|
123
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getBean(java.lang.String)
|
124
|
*/
|
125
|
@Override
|
126
|
public Object getBean(String arg0) {
|
127
|
return defaultApplicationConfiguration.getBean(arg0);
|
128
|
}
|
129
|
|
130
|
/**
|
131
|
* @return
|
132
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getClassificationService()
|
133
|
*/
|
134
|
@Override
|
135
|
public IClassificationService getClassificationService() {
|
136
|
return new TransientClassificationService(defaultApplicationConfiguration.getClassificationService());
|
137
|
}
|
138
|
|
139
|
/**
|
140
|
* @return
|
141
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCollectionService()
|
142
|
*/
|
143
|
@Override
|
144
|
public ICollectionService getCollectionService() {
|
145
|
return defaultApplicationConfiguration.getCollectionService();
|
146
|
// return new TransientCollectionService(defaultApplicationConfiguration.getCollectionService());
|
147
|
}
|
148
|
|
149
|
/**
|
150
|
* @return
|
151
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCommonService()
|
152
|
*/
|
153
|
@Override
|
154
|
public ICommonService getCommonService() {
|
155
|
return defaultApplicationConfiguration.getCommonService();
|
156
|
// return new TransientCommonService(defaultApplicationConfiguration.getCommonService());
|
157
|
}
|
158
|
|
159
|
/**
|
160
|
* @return
|
161
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getDatabaseService()
|
162
|
*/
|
163
|
@Override
|
164
|
public IDatabaseService getDatabaseService() {
|
165
|
return defaultApplicationConfiguration.getDatabaseService();
|
166
|
// return new TransientDatabaseService(defaultApplicationConfiguration.getDatabaseService());
|
167
|
}
|
168
|
|
169
|
/**
|
170
|
* @return
|
171
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getDescriptionService()
|
172
|
*/
|
173
|
@Override
|
174
|
public IDescriptionService getDescriptionService() {
|
175
|
return new TransientDescriptionService(defaultApplicationConfiguration.getDescriptionService());
|
176
|
}
|
177
|
|
178
|
/**
|
179
|
* @return
|
180
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getFeatureNodeService()
|
181
|
*/
|
182
|
@Override
|
183
|
public IFeatureNodeService getFeatureNodeService() {
|
184
|
return defaultApplicationConfiguration.getFeatureNodeService();
|
185
|
// return new TransientFeatureNodeService(defaultApplicationConfiguration.getFeatureNodeService());
|
186
|
}
|
187
|
|
188
|
/**
|
189
|
* @return
|
190
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getFeatureTreeService()
|
191
|
*/
|
192
|
@Override
|
193
|
public IFeatureTreeService getFeatureTreeService() {
|
194
|
return defaultApplicationConfiguration.getFeatureTreeService();
|
195
|
// return new TransientFeatureTreeService(defaultApplicationConfiguration.getFeatureTreeService());
|
196
|
}
|
197
|
|
198
|
/**
|
199
|
* @return
|
200
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getGrantedAuthorityService()
|
201
|
*/
|
202
|
@Override
|
203
|
public IGrantedAuthorityService getGrantedAuthorityService() {
|
204
|
return defaultApplicationConfiguration.getGrantedAuthorityService();
|
205
|
// return new TransientGrantedAuthorityService(defaultApplicationConfiguration.getGrantedAuthorityService());
|
206
|
}
|
207
|
|
208
|
/**
|
209
|
* @return
|
210
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getGroupService()
|
211
|
*/
|
212
|
@Override
|
213
|
public IGroupService getGroupService() {
|
214
|
return defaultApplicationConfiguration.getGroupService();
|
215
|
// return new TransientGroupService(defaultApplicationConfiguration.getGroupService());
|
216
|
}
|
217
|
|
218
|
/**
|
219
|
* @return
|
220
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getIdentificationKeyService()
|
221
|
*/
|
222
|
@Override
|
223
|
public IIdentificationKeyService getIdentificationKeyService() {
|
224
|
return defaultApplicationConfiguration.getIdentificationKeyService();
|
225
|
// return new TransientIdentificationService(defaultApplicationConfiguration.getIdentificationKeyService());
|
226
|
}
|
227
|
|
228
|
/**
|
229
|
* @return
|
230
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getLocationService()
|
231
|
*/
|
232
|
@Override
|
233
|
public ILocationService getLocationService() {
|
234
|
return defaultApplicationConfiguration.getLocationService();
|
235
|
// return new TransientLocationService(defaultApplicationConfiguration.getLocationService());
|
236
|
}
|
237
|
|
238
|
/**
|
239
|
* @return
|
240
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getMainService()
|
241
|
*/
|
242
|
@Override
|
243
|
public IService<CdmBase> getMainService() {
|
244
|
return defaultApplicationConfiguration.getMainService();
|
245
|
// return new TransientMainService(defaultApplicationConfiguration.getMainService());
|
246
|
}
|
247
|
|
248
|
/**
|
249
|
* @return
|
250
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getMediaService()
|
251
|
*/
|
252
|
@Override
|
253
|
public IMediaService getMediaService() {
|
254
|
return defaultApplicationConfiguration.getMediaService();
|
255
|
// return new TransientMediaService(defaultApplicationConfiguration.getMediaService());
|
256
|
}
|
257
|
|
258
|
/**
|
259
|
* @return
|
260
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getNameService()
|
261
|
*/
|
262
|
@Override
|
263
|
public INameService getNameService() {
|
264
|
return new TransientNameService(defaultApplicationConfiguration.getNameService());
|
265
|
}
|
266
|
|
267
|
/**
|
268
|
* @return
|
269
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getOccurrenceService()
|
270
|
*/
|
271
|
@Override
|
272
|
public IOccurrenceService getOccurrenceService() {
|
273
|
if(occurenceService==null){
|
274
|
occurenceService = new TransientOccurenceService(defaultApplicationConfiguration.getOccurrenceService());
|
275
|
}
|
276
|
return occurenceService;
|
277
|
}
|
278
|
|
279
|
/**
|
280
|
* @return
|
281
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPermissionEvaluator()
|
282
|
*/
|
283
|
@Override
|
284
|
public ICdmPermissionEvaluator getPermissionEvaluator() {
|
285
|
return defaultApplicationConfiguration.getPermissionEvaluator();
|
286
|
}
|
287
|
|
288
|
/**
|
289
|
* @return
|
290
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPolytomousKeyNodeService()
|
291
|
*/
|
292
|
@Override
|
293
|
public IPolytomousKeyNodeService getPolytomousKeyNodeService() {
|
294
|
return defaultApplicationConfiguration.getPolytomousKeyNodeService();
|
295
|
// return new TransientPolytomousKeyNodeService(defaultApplicationConfiguration.getPolytomousKeyNodeService());
|
296
|
}
|
297
|
|
298
|
/**
|
299
|
* @return
|
300
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPolytomousKeyService()
|
301
|
*/
|
302
|
@Override
|
303
|
public IPolytomousKeyService getPolytomousKeyService() {
|
304
|
return defaultApplicationConfiguration.getPolytomousKeyService();
|
305
|
// return new TransientPolytomousKeyService(defaultApplicationConfiguration.getPolytomousKeyService());
|
306
|
}
|
307
|
|
308
|
/**
|
309
|
* @return
|
310
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getReferenceService()
|
311
|
*/
|
312
|
@Override
|
313
|
public IReferenceService getReferenceService() {
|
314
|
return new TransientReferenceService(defaultApplicationConfiguration.getReferenceService());
|
315
|
}
|
316
|
|
317
|
/**
|
318
|
* @return
|
319
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTaxonNodeService()
|
320
|
*/
|
321
|
@Override
|
322
|
public ITaxonNodeService getTaxonNodeService() {
|
323
|
return defaultApplicationConfiguration.getTaxonNodeService();
|
324
|
// return new TransientTaxonNodeService(defaultApplicationConfiguration.getTaxonNodeService());
|
325
|
}
|
326
|
|
327
|
/**
|
328
|
* @return
|
329
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTaxonService()
|
330
|
*/
|
331
|
@Override
|
332
|
public ITaxonService getTaxonService() {
|
333
|
return new TransientTaxonService(defaultApplicationConfiguration.getTaxonService());
|
334
|
}
|
335
|
|
336
|
/**
|
337
|
* @return
|
338
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTermService()
|
339
|
*/
|
340
|
@Override
|
341
|
public ITermService getTermService() {
|
342
|
return new TransientTermService(defaultApplicationConfiguration.getTermService());
|
343
|
}
|
344
|
|
345
|
/**
|
346
|
* @return
|
347
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTransactionManager()
|
348
|
*/
|
349
|
@Override
|
350
|
public PlatformTransactionManager getTransactionManager() {
|
351
|
return defaultApplicationConfiguration.getTransactionManager();
|
352
|
}
|
353
|
|
354
|
/**
|
355
|
* @return
|
356
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getUserService()
|
357
|
*/
|
358
|
@Override
|
359
|
public IUserService getUserService() {
|
360
|
return defaultApplicationConfiguration.getUserService();
|
361
|
// return new TransientUserService(defaultApplicationConfiguration.getUserService());
|
362
|
}
|
363
|
|
364
|
/**
|
365
|
* @return
|
366
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getVocabularyService()
|
367
|
*/
|
368
|
@Override
|
369
|
public IVocabularyService getVocabularyService() {
|
370
|
return defaultApplicationConfiguration.getVocabularyService();
|
371
|
// return new TransientVocabularyService(defaultApplicationConfiguration.getVocabularyService());
|
372
|
}
|
373
|
|
374
|
/**
|
375
|
* @return
|
376
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getWorkingSetService()
|
377
|
*/
|
378
|
@Override
|
379
|
public IWorkingSetService getWorkingSetService() {
|
380
|
return defaultApplicationConfiguration.getWorkingSetService();
|
381
|
// return new TransientWorkingSetService(defaultApplicationConfiguration.getWorkingSetService());
|
382
|
}
|
383
|
|
384
|
/**
|
385
|
* @return
|
386
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()
|
387
|
*/
|
388
|
@Override
|
389
|
public TransactionStatus startTransaction() {
|
390
|
return defaultApplicationConfiguration.startTransaction();
|
391
|
}
|
392
|
|
393
|
/**
|
394
|
* @param arg0
|
395
|
* @return
|
396
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction(java.lang.Boolean)
|
397
|
*/
|
398
|
@Override
|
399
|
public TransactionStatus startTransaction(Boolean arg0) {
|
400
|
return defaultApplicationConfiguration.startTransaction(arg0);
|
401
|
}
|
402
|
|
403
|
/* (non-Javadoc)
|
404
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPrimerService()
|
405
|
*/
|
406
|
@Override
|
407
|
public IPrimerService getPrimerService() {
|
408
|
return defaultApplicationConfiguration.getPrimerService();
|
409
|
}
|
410
|
|
411
|
/* (non-Javadoc)
|
412
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAmplificationService()
|
413
|
*/
|
414
|
@Override
|
415
|
public IAmplificationService getAmplificationService() {
|
416
|
return defaultApplicationConfiguration.getAmplificationService();
|
417
|
}
|
418
|
|
419
|
/* (non-Javadoc)
|
420
|
* @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getSequenceService()
|
421
|
*/
|
422
|
@Override
|
423
|
public ISequenceService getSequenceService() {
|
424
|
return defaultApplicationConfiguration.getSequenceService();
|
425
|
}
|
426
|
}
|