36cc5234578d40859de73acbbcb8b04c6a8ea99c
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / dataimport / transientServices / TransientCdmRepository.java
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.dataimport.transientServices;
11
12 import java.util.List;
13
14 import org.springframework.security.access.PermissionEvaluator;
15 import org.springframework.security.authentication.ProviderManager;
16 import org.springframework.transaction.PlatformTransactionManager;
17 import org.springframework.transaction.TransactionStatus;
18
19 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
20 import eu.etaxonomy.cdm.api.application.ICdmApplicationDefaultConfiguration;
21 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
22 import eu.etaxonomy.cdm.api.service.IAgentService;
23 import eu.etaxonomy.cdm.api.service.IClassificationService;
24 import eu.etaxonomy.cdm.api.service.ICollectionService;
25 import eu.etaxonomy.cdm.api.service.ICommonService;
26 import eu.etaxonomy.cdm.api.service.IDatabaseService;
27 import eu.etaxonomy.cdm.api.service.IDescriptionService;
28 import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
29 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
30 import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
31 import eu.etaxonomy.cdm.api.service.IGroupService;
32 import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;
33 import eu.etaxonomy.cdm.api.service.ILocationService;
34 import eu.etaxonomy.cdm.api.service.IMediaService;
35 import eu.etaxonomy.cdm.api.service.INameService;
36 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
37 import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
38 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
39 import eu.etaxonomy.cdm.api.service.IReferenceService;
40 import eu.etaxonomy.cdm.api.service.IService;
41 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
42 import eu.etaxonomy.cdm.api.service.ITaxonService;
43 import eu.etaxonomy.cdm.api.service.ITermService;
44 import eu.etaxonomy.cdm.api.service.IUserService;
45 import eu.etaxonomy.cdm.api.service.IVocabularyService;
46 import eu.etaxonomy.cdm.api.service.IWorkingSetService;
47 import eu.etaxonomy.cdm.model.common.CdmBase;
48 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
49 import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;
50
51 /**
52 * @author pplitzner
53 * @date 26.09.2013
54 *
55 */
56 public class TransientCdmRepository implements ICdmApplicationDefaultConfiguration {
57
58 private ICdmApplicationDefaultConfiguration defaultApplicationConfiguration;
59 private TransientOccurenceService occurenceService;
60
61 public List<SpecimenOrObservationBase> getUnits(){
62 return occurenceService.getUnits();
63 }
64
65 /**
66 * @param defaultApplicationConfiguration
67 */
68 public TransientCdmRepository(ICdmApplicationDefaultConfiguration defaultApplicationConfiguration) {
69 this.defaultApplicationConfiguration = defaultApplicationConfiguration;
70 }
71
72 /**
73 * @return
74 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#NewConversation()
75 */
76 @Override
77 public ConversationHolder NewConversation() {
78 return defaultApplicationConfiguration.NewConversation();
79 }
80
81 /**
82 * @param arg0
83 * @param arg1
84 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#authenticate(java.lang.String, java.lang.String)
85 */
86 @Override
87 public void authenticate(String arg0, String arg1) {
88 defaultApplicationConfiguration.authenticate(arg0, arg1);
89 }
90
91 /**
92 * @param arg0
93 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#commitTransaction(org.springframework.transaction.TransactionStatus)
94 */
95 @Override
96 public void commitTransaction(TransactionStatus arg0) {
97 defaultApplicationConfiguration.commitTransaction(arg0);
98 }
99
100 /**
101 * @return
102 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAgentService()
103 */
104 @Override
105 public IAgentService getAgentService() {
106 return new TransientAgentService(defaultApplicationConfiguration.getAgentService());
107 }
108
109 /**
110 * @return
111 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAuthenticationManager()
112 */
113 @Override
114 public ProviderManager getAuthenticationManager() {
115 return defaultApplicationConfiguration.getAuthenticationManager();
116 }
117
118 /**
119 * @param arg0
120 * @return
121 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getBean(java.lang.String)
122 */
123 @Override
124 public Object getBean(String arg0) {
125 return defaultApplicationConfiguration.getBean(arg0);
126 }
127
128 /**
129 * @return
130 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getClassificationService()
131 */
132 @Override
133 public IClassificationService getClassificationService() {
134 return new TransientClassificationService(defaultApplicationConfiguration.getClassificationService());
135 }
136
137 /**
138 * @return
139 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCollectionService()
140 */
141 @Override
142 public ICollectionService getCollectionService() {
143 return new TransientCollectionService(defaultApplicationConfiguration.getCollectionService());
144 }
145
146 /**
147 * @return
148 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getCommonService()
149 */
150 @Override
151 public ICommonService getCommonService() {
152 return defaultApplicationConfiguration.getCommonService();
153 }
154
155 /**
156 * @return
157 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getDatabaseService()
158 */
159 @Override
160 public IDatabaseService getDatabaseService() {
161 return defaultApplicationConfiguration.getDatabaseService();
162 }
163
164 /**
165 * @return
166 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getDescriptionService()
167 */
168 @Override
169 public IDescriptionService getDescriptionService() {
170 return new TransientDescriptionService(defaultApplicationConfiguration.getDescriptionService());
171 }
172
173 /**
174 * @return
175 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getFeatureNodeService()
176 */
177 @Override
178 public IFeatureNodeService getFeatureNodeService() {
179 return defaultApplicationConfiguration.getFeatureNodeService();
180 }
181
182 /**
183 * @return
184 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getFeatureTreeService()
185 */
186 @Override
187 public IFeatureTreeService getFeatureTreeService() {
188 return defaultApplicationConfiguration.getFeatureTreeService();
189 }
190
191 /**
192 * @return
193 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getGrantedAuthorityService()
194 */
195 @Override
196 public IGrantedAuthorityService getGrantedAuthorityService() {
197 return defaultApplicationConfiguration.getGrantedAuthorityService();
198 }
199
200 /**
201 * @return
202 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getGroupService()
203 */
204 @Override
205 public IGroupService getGroupService() {
206 return defaultApplicationConfiguration.getGroupService();
207 }
208
209 /**
210 * @return
211 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getIdentificationKeyService()
212 */
213 @Override
214 public IIdentificationKeyService getIdentificationKeyService() {
215 return defaultApplicationConfiguration.getIdentificationKeyService();
216 }
217
218 /**
219 * @return
220 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getLocationService()
221 */
222 @Override
223 public ILocationService getLocationService() {
224 return defaultApplicationConfiguration.getLocationService();
225 }
226
227 /**
228 * @return
229 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getMainService()
230 */
231 @Override
232 public IService<CdmBase> getMainService() {
233 return defaultApplicationConfiguration.getMainService();
234 }
235
236 /**
237 * @return
238 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getMediaService()
239 */
240 @Override
241 public IMediaService getMediaService() {
242 return defaultApplicationConfiguration.getMediaService();
243 }
244
245 /**
246 * @return
247 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getNameService()
248 */
249 @Override
250 public INameService getNameService() {
251 return new TransientNameService(defaultApplicationConfiguration.getNameService());
252 }
253
254 /**
255 * @return
256 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getOccurrenceService()
257 */
258 @Override
259 public IOccurrenceService getOccurrenceService() {
260 if(occurenceService==null){
261 occurenceService = new TransientOccurenceService(defaultApplicationConfiguration.getOccurrenceService());
262 }
263 return occurenceService;
264 }
265
266 /**
267 * @return
268 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPermissionEvaluator()
269 */
270 @Override
271 public ICdmPermissionEvaluator getPermissionEvaluator() {
272 return defaultApplicationConfiguration.getPermissionEvaluator();
273 }
274
275 /**
276 * @return
277 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPolytomousKeyNodeService()
278 */
279 @Override
280 public IPolytomousKeyNodeService getPolytomousKeyNodeService() {
281 return defaultApplicationConfiguration.getPolytomousKeyNodeService();
282 }
283
284 /**
285 * @return
286 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getPolytomousKeyService()
287 */
288 @Override
289 public IPolytomousKeyService getPolytomousKeyService() {
290 return defaultApplicationConfiguration.getPolytomousKeyService();
291 }
292
293 /**
294 * @return
295 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getReferenceService()
296 */
297 @Override
298 public IReferenceService getReferenceService() {
299 return new TransientReferenceService(defaultApplicationConfiguration.getReferenceService());
300 }
301
302 /**
303 * @return
304 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTaxonNodeService()
305 */
306 @Override
307 public ITaxonNodeService getTaxonNodeService() {
308 return defaultApplicationConfiguration.getTaxonNodeService();
309 }
310
311 /**
312 * @return
313 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTaxonService()
314 */
315 @Override
316 public ITaxonService getTaxonService() {
317 return new TransientTaxonService(defaultApplicationConfiguration.getTaxonService());
318 }
319
320 /**
321 * @return
322 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTermService()
323 */
324 @Override
325 public ITermService getTermService() {
326 return new TransientTermService(defaultApplicationConfiguration.getTermService());
327 }
328
329 /**
330 * @return
331 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getTransactionManager()
332 */
333 @Override
334 public PlatformTransactionManager getTransactionManager() {
335 return defaultApplicationConfiguration.getTransactionManager();
336 }
337
338 /**
339 * @return
340 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getUserService()
341 */
342 @Override
343 public IUserService getUserService() {
344 return defaultApplicationConfiguration.getUserService();
345 }
346
347 /**
348 * @return
349 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getVocabularyService()
350 */
351 @Override
352 public IVocabularyService getVocabularyService() {
353 return defaultApplicationConfiguration.getVocabularyService();
354 }
355
356 /**
357 * @return
358 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getWorkingSetService()
359 */
360 @Override
361 public IWorkingSetService getWorkingSetService() {
362 return defaultApplicationConfiguration.getWorkingSetService();
363 }
364
365 /**
366 * @return
367 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()
368 */
369 @Override
370 public TransactionStatus startTransaction() {
371 return defaultApplicationConfiguration.startTransaction();
372 }
373
374 /**
375 * @param arg0
376 * @return
377 * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction(java.lang.Boolean)
378 */
379 @Override
380 public TransactionStatus startTransaction(Boolean arg0) {
381 return defaultApplicationConfiguration.startTransaction(arg0);
382 }
383
384
385
386 }