1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.io.common;
|
11
|
|
12
|
import java.lang.reflect.Method;
|
13
|
import java.util.List;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
|
19
|
import eu.etaxonomy.cdm.database.DataSourceNotFoundException;
|
20
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
21
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
22
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
23
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.DO_REFERENCES;
|
24
|
import eu.etaxonomy.cdm.model.agent.Person;
|
25
|
import eu.etaxonomy.cdm.model.common.Language;
|
26
|
import eu.etaxonomy.cdm.model.common.init.TermNotFoundException;
|
27
|
import eu.etaxonomy.cdm.model.description.Feature;
|
28
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
29
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
30
|
|
31
|
/**
|
32
|
* @author a.mueller
|
33
|
* @created 20.06.2008
|
34
|
* @version 1.0
|
35
|
*/
|
36
|
public abstract class ImportConfiguratorBase extends IoConfiguratorBase {
|
37
|
private static final Logger logger = Logger.getLogger(ImportConfiguratorBase.class);
|
38
|
|
39
|
//check
|
40
|
private CHECK check = CHECK.CHECK_AND_IMPORT;
|
41
|
|
42
|
//TODO
|
43
|
private boolean deleteAll = false;
|
44
|
|
45
|
// private boolean doAuthors = true;
|
46
|
// //references
|
47
|
// private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
48
|
// //names
|
49
|
// private boolean doTaxonNames = true;
|
50
|
// private boolean doRelNames = true;
|
51
|
// private boolean doNameStatus = true;
|
52
|
// private boolean doTypes = true;
|
53
|
// private boolean doNameFacts = true;
|
54
|
//
|
55
|
// //taxa
|
56
|
// private boolean doTaxa = true;
|
57
|
// private boolean doRelTaxa = true;
|
58
|
// private boolean doFacts = true;
|
59
|
//
|
60
|
// //occurrence
|
61
|
// private boolean doOccurrence = true;
|
62
|
|
63
|
/* For Jaxb import - is defined in JaxbImportConfigurator */
|
64
|
// private boolean doTerms = true;
|
65
|
// private boolean doTermVocabularies = true;
|
66
|
// private boolean doHomotypicalGroups = true;
|
67
|
// private boolean doReferencedEntities = true;
|
68
|
// private boolean doFeatureData = true;
|
69
|
// private boolean doMedia = true;
|
70
|
// private boolean doLanguageData = true;
|
71
|
/* end for Jaxb import */
|
72
|
|
73
|
//nullValues
|
74
|
private boolean ignoreNull = false;
|
75
|
|
76
|
//Nomenclatural Code
|
77
|
private NomenclaturalCode nomenclaturalCode = null;
|
78
|
// protected Class<ICdmIO>[] ioClassList;
|
79
|
|
80
|
private MapWrapper<Feature> featureMap = new MapWrapper<Feature>(null);
|
81
|
|
82
|
//uuid of concept reference
|
83
|
private UUID secUuid = UUID.randomUUID();
|
84
|
private Object sourceSecId = -1;
|
85
|
|
86
|
private Object source;
|
87
|
protected ReferenceBase sourceReference;
|
88
|
private ICdmDataSource destination;
|
89
|
private Person commentator = Person.NewTitledInstance("automatic BerlinModel2CDM importer");
|
90
|
|
91
|
private Language factLanguage = Language.ENGLISH();
|
92
|
private CdmApplicationController cdmApp = null;
|
93
|
protected Class<ICdmIO>[] ioClassList;
|
94
|
|
95
|
/* *****************CONSTRUCTOR *****************************/
|
96
|
|
97
|
public ImportConfiguratorBase(){
|
98
|
super();
|
99
|
makeIoClassList();
|
100
|
}
|
101
|
|
102
|
abstract protected void makeIoClassList();
|
103
|
|
104
|
/**
|
105
|
* @param source the source to set
|
106
|
*/
|
107
|
public void setSource(Object source) {
|
108
|
this.source = source;
|
109
|
}
|
110
|
|
111
|
|
112
|
/**
|
113
|
* @param source the source to get
|
114
|
*/
|
115
|
public Object getSource() {
|
116
|
return source;
|
117
|
}
|
118
|
|
119
|
|
120
|
/* (non-Javadoc)
|
121
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isValid()
|
122
|
*/
|
123
|
public boolean isValid(){
|
124
|
boolean result = true;
|
125
|
if (source == null){
|
126
|
logger.warn("Connection to BerlinModel could not be established");
|
127
|
result = false;
|
128
|
}
|
129
|
if (destination == null){
|
130
|
logger.warn("Connection to Cdm could not be established");
|
131
|
result = false;
|
132
|
}
|
133
|
|
134
|
return result;
|
135
|
}
|
136
|
|
137
|
|
138
|
|
139
|
/* ****************** GETTER/SETTER **************************/
|
140
|
/* (non-Javadoc)
|
141
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDeleteAll()
|
142
|
*/
|
143
|
public boolean isDeleteAll() {
|
144
|
return deleteAll;
|
145
|
}
|
146
|
/* (non-Javadoc)
|
147
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDeleteAll(boolean)
|
148
|
*/
|
149
|
public void setDeleteAll(boolean deleteAll) {
|
150
|
this.deleteAll = deleteAll;
|
151
|
}
|
152
|
/* (non-Javadoc)
|
153
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoAuthors()
|
154
|
*/
|
155
|
// public boolean isDoAuthors() {
|
156
|
// return doAuthors;
|
157
|
// }
|
158
|
// /* (non-Javadoc)
|
159
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoAuthors(boolean)
|
160
|
// */
|
161
|
// public void setDoAuthors(boolean doAuthors) {
|
162
|
// this.doAuthors = doAuthors;
|
163
|
// }
|
164
|
//
|
165
|
// /* (non-Javadoc)
|
166
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getDoReferences()
|
167
|
// */
|
168
|
// public DO_REFERENCES getDoReferences() {
|
169
|
// return doReferences;
|
170
|
// }
|
171
|
// /* (non-Javadoc)
|
172
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoReferences(eu.etaxonomy.cdm.io.tcs.TcsImportConfigurator.DO_REFERENCES)
|
173
|
// */
|
174
|
// public void setDoReferences(DO_REFERENCES doReferences) {
|
175
|
// this.doReferences = doReferences;
|
176
|
// }
|
177
|
|
178
|
/* (non-Javadoc)
|
179
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getCheck()
|
180
|
*/
|
181
|
public CHECK getCheck() {
|
182
|
return this.check;
|
183
|
}
|
184
|
|
185
|
/* (non-Javadoc)
|
186
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setCheck(eu.etaxonomy.cdm.io.tcs.TcsImportConfigurator.CHECK)
|
187
|
*/
|
188
|
public void setCheck(CHECK check) {
|
189
|
this.check = check;
|
190
|
}
|
191
|
|
192
|
|
193
|
/* (non-Javadoc)
|
194
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoTaxonNames()
|
195
|
*/
|
196
|
// public boolean isDoTaxonNames() {
|
197
|
// return doTaxonNames;
|
198
|
// }
|
199
|
// /* (non-Javadoc)
|
200
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoTaxonNames(boolean)
|
201
|
// */
|
202
|
// public void setDoTaxonNames(boolean doTaxonNames) {
|
203
|
// this.doTaxonNames = doTaxonNames;
|
204
|
// }
|
205
|
// /* (non-Javadoc)
|
206
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoRelNames()
|
207
|
// */
|
208
|
// public boolean isDoRelNames() {
|
209
|
// return doRelNames;
|
210
|
// }
|
211
|
// /* (non-Javadoc)
|
212
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoRelNames(boolean)
|
213
|
// */
|
214
|
// public void setDoRelNames(boolean doRelNames) {
|
215
|
// this.doRelNames = doRelNames;
|
216
|
// }
|
217
|
// /* (non-Javadoc)
|
218
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoNameStatus()
|
219
|
// */
|
220
|
// public boolean isDoNameStatus() {
|
221
|
// return doNameStatus;
|
222
|
// }
|
223
|
// /* (non-Javadoc)
|
224
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoNameStatus(boolean)
|
225
|
// */
|
226
|
// public void setDoNameStatus(boolean doNameStatus) {
|
227
|
// this.doNameStatus = doNameStatus;
|
228
|
// }
|
229
|
// /* (non-Javadoc)
|
230
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoNameFacts()
|
231
|
// */
|
232
|
// public boolean isDoNameFacts() {
|
233
|
// return doNameFacts;
|
234
|
// }
|
235
|
// /* (non-Javadoc)
|
236
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoNameFacts(boolean)
|
237
|
// */
|
238
|
// public void setDoNameFacts(boolean doNameFacts) {
|
239
|
// this.doNameFacts = doNameFacts;
|
240
|
// }
|
241
|
// /* (non-Javadoc)
|
242
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoTypes()
|
243
|
// */
|
244
|
// public boolean isDoTypes() {
|
245
|
// return doTypes;
|
246
|
// }
|
247
|
// /* (non-Javadoc)
|
248
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoTypes(boolean)
|
249
|
// */
|
250
|
// public void setDoTypes(boolean doTypes) {
|
251
|
// this.doTypes = doTypes;
|
252
|
// }
|
253
|
// /* (non-Javadoc)
|
254
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoTaxa()
|
255
|
// */
|
256
|
// public boolean isDoTaxa() {
|
257
|
// return doTaxa;
|
258
|
// }
|
259
|
// /* (non-Javadoc)
|
260
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoTaxa(boolean)
|
261
|
// */
|
262
|
// public void setDoTaxa(boolean doTaxa) {
|
263
|
// this.doTaxa = doTaxa;
|
264
|
// }
|
265
|
// /* (non-Javadoc)
|
266
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoRelTaxa()
|
267
|
// */
|
268
|
// public boolean isDoRelTaxa() {
|
269
|
// return doRelTaxa;
|
270
|
// }
|
271
|
// /* (non-Javadoc)
|
272
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoRelTaxa(boolean)
|
273
|
// */
|
274
|
// public void setDoRelTaxa(boolean doRelTaxa) {
|
275
|
// this.doRelTaxa = doRelTaxa;
|
276
|
// }
|
277
|
// /* (non-Javadoc)
|
278
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoFacts()
|
279
|
// */
|
280
|
// public boolean isDoFacts() {
|
281
|
// return doFacts;
|
282
|
// }
|
283
|
// /* (non-Javadoc)
|
284
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoFacts(boolean)
|
285
|
// */
|
286
|
// public void setDoFacts(boolean doFacts) {
|
287
|
// this.doFacts = doFacts;
|
288
|
// }
|
289
|
// /* (non-Javadoc)
|
290
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#isDoOccurrence()
|
291
|
// */
|
292
|
// public boolean isDoOccurrence() {
|
293
|
// return doOccurrence;
|
294
|
// }
|
295
|
// /* (non-Javadoc)
|
296
|
// * @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDoOccurrence(boolean)
|
297
|
// */
|
298
|
// public void setDoOccurrence(boolean doOccurrence) {
|
299
|
// this.doOccurrence = doOccurrence;
|
300
|
// }
|
301
|
|
302
|
/*
|
303
|
* For Jaxb Import
|
304
|
* TODO: Cleanup
|
305
|
*/
|
306
|
|
307
|
// public boolean isDoTerms() {
|
308
|
// return doTerms;
|
309
|
// }
|
310
|
//
|
311
|
// public void setDoTerms(boolean doTerms) {
|
312
|
// this.doTerms = doTerms;
|
313
|
// }
|
314
|
//
|
315
|
// public boolean isDoTermVocabularies() {
|
316
|
// return doTermVocabularies;
|
317
|
// }
|
318
|
//
|
319
|
// public void setDoTermVocabularies(boolean doTermVocabularies) {
|
320
|
// this.doTermVocabularies = doTermVocabularies;
|
321
|
// }
|
322
|
//
|
323
|
// public boolean isDoHomotypicalGroups() {
|
324
|
// return doHomotypicalGroups;
|
325
|
// }
|
326
|
//
|
327
|
// public void setDoHomotypicalGroups(boolean doHomotypicalGroups) {
|
328
|
// this.doHomotypicalGroups = doHomotypicalGroups;
|
329
|
// }
|
330
|
//
|
331
|
// public boolean isDoReferencedEntities() {
|
332
|
// return doReferencedEntities;
|
333
|
// }
|
334
|
//
|
335
|
// public void setDoReferencedEntities(boolean doReferencedEntities) {
|
336
|
// this.doReferencedEntities = doReferencedEntities;
|
337
|
// }
|
338
|
//
|
339
|
// public boolean isDoFeatureData() {
|
340
|
// return doFeatureData;
|
341
|
// }
|
342
|
//
|
343
|
// public void setDoFeatureData(boolean doFeatureData) {
|
344
|
// this.doFeatureData = doFeatureData;
|
345
|
// }
|
346
|
//
|
347
|
// public boolean isDoMedia() {
|
348
|
// return doMedia;
|
349
|
// }
|
350
|
//
|
351
|
// public void setDoMedia(boolean doMedia) {
|
352
|
// this.doMedia = doMedia;
|
353
|
// }
|
354
|
//
|
355
|
// public boolean isDoLanguageData() {
|
356
|
// return doLanguageData;
|
357
|
// }
|
358
|
//
|
359
|
// public void setDoLanguageData(boolean doLanguageData) {
|
360
|
// this.doLanguageData = doLanguageData;
|
361
|
// }
|
362
|
|
363
|
/*
|
364
|
* end for Jaxb import
|
365
|
*/
|
366
|
|
367
|
/**
|
368
|
* If true, no errors occurs if objects are not found that should exist. This may
|
369
|
* be needed e.g. when only subsets of the data are imported.
|
370
|
* Default value is <cod>false</code>.
|
371
|
* @return the ignoreNull
|
372
|
*/
|
373
|
public boolean isIgnoreNull() {
|
374
|
return ignoreNull;
|
375
|
}
|
376
|
|
377
|
/**
|
378
|
* @param ignoreNull the ignoreNull to set
|
379
|
*/
|
380
|
public void setIgnoreNull(boolean ignoreNull) {
|
381
|
this.ignoreNull = ignoreNull;
|
382
|
}
|
383
|
|
384
|
/* (non-Javadoc)
|
385
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getDestination()
|
386
|
*/
|
387
|
public ICdmDataSource getDestination() {
|
388
|
return destination;
|
389
|
}
|
390
|
/* (non-Javadoc)
|
391
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDestination(eu.etaxonomy.cdm.database.ICdmDataSource)
|
392
|
*/
|
393
|
public void setDestination(ICdmDataSource destination) {
|
394
|
this.destination = destination;
|
395
|
}
|
396
|
|
397
|
/* (non-Javadoc)
|
398
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getDbSchemaValidation()
|
399
|
*/
|
400
|
// public DbSchemaValidation getDbSchemaValidation() {
|
401
|
// return dbSchemaValidation;
|
402
|
// }
|
403
|
/* (non-Javadoc)
|
404
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setDbSchemaValidation(eu.etaxonomy.cdm.database.DbSchemaValidation)
|
405
|
*/
|
406
|
// public void setDbSchemaValidation(DbSchemaValidation dbSchemaValidation) {
|
407
|
// this.dbSchemaValidation = dbSchemaValidation;
|
408
|
// }
|
409
|
|
410
|
/* (non-Javadoc)
|
411
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getSourceReference()
|
412
|
*/
|
413
|
public abstract ReferenceBase getSourceReference();
|
414
|
/* (non-Javadoc)
|
415
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setSourceReference(eu.etaxonomy.cdm.model.reference.ReferenceBase)
|
416
|
*/
|
417
|
public void setSourceReference(ReferenceBase sourceReference) {
|
418
|
this.sourceReference = sourceReference;
|
419
|
}
|
420
|
/* (non-Javadoc)
|
421
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getSourceReferenceTitle()
|
422
|
*/
|
423
|
public String getSourceReferenceTitle() {
|
424
|
return getSourceReference().getTitleCache();
|
425
|
}
|
426
|
/* (non-Javadoc)
|
427
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setSourceReferenceTitle(java.lang.String)
|
428
|
*/
|
429
|
public void setSourceReferenceTitle(String sourceReferenceTitle) {
|
430
|
getSourceReference().setTitleCache(sourceReferenceTitle);
|
431
|
}
|
432
|
|
433
|
|
434
|
/* (non-Javadoc)
|
435
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getCommentator()
|
436
|
*/
|
437
|
public Person getCommentator() {
|
438
|
return commentator;
|
439
|
}
|
440
|
|
441
|
/* (non-Javadoc)
|
442
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setCommentator(eu.etaxonomy.cdm.model.agent.Person)
|
443
|
*/
|
444
|
public void setCommentator(Person commentator) {
|
445
|
this.commentator = commentator;
|
446
|
}
|
447
|
|
448
|
|
449
|
/* (non-Javadoc)
|
450
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#getFactLanguage()
|
451
|
*/
|
452
|
public Language getFactLanguage() {
|
453
|
return factLanguage;
|
454
|
}
|
455
|
|
456
|
|
457
|
/* (non-Javadoc)
|
458
|
* @see eu.etaxonomy.cdm.io.tcs.IImportConfigurator#setFactLanguage(eu.etaxonomy.cdm.model.common.Language)
|
459
|
*/
|
460
|
public void setFactLanguage(Language factLanguage) {
|
461
|
this.factLanguage = factLanguage;
|
462
|
}
|
463
|
|
464
|
|
465
|
/**
|
466
|
* @return the nomenclaturalCode
|
467
|
*/
|
468
|
public NomenclaturalCode getNomenclaturalCode() {
|
469
|
return nomenclaturalCode;
|
470
|
}
|
471
|
|
472
|
|
473
|
/**
|
474
|
* @param nomenclaturalCode the nomenclaturalCode to set
|
475
|
*/
|
476
|
public void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode) {
|
477
|
this.nomenclaturalCode = nomenclaturalCode;
|
478
|
}
|
479
|
|
480
|
|
481
|
/**
|
482
|
* @return the secUuid
|
483
|
*/
|
484
|
public UUID getSecUuid() {
|
485
|
return secUuid;
|
486
|
}
|
487
|
|
488
|
|
489
|
/**
|
490
|
* @param secUuid the secUuid to set
|
491
|
*/
|
492
|
public void setSecUuid(UUID secUuid) {
|
493
|
this.secUuid = secUuid;
|
494
|
}
|
495
|
|
496
|
/**
|
497
|
* @return the sourceSecId
|
498
|
*/
|
499
|
public Object getSourceSecId() {
|
500
|
return sourceSecId;
|
501
|
}
|
502
|
|
503
|
/**
|
504
|
* @param sourceSecId the sourceSecId to set
|
505
|
*/
|
506
|
public void setSourceSecId(Object sourceSecId) {
|
507
|
this.sourceSecId = sourceSecId;
|
508
|
}
|
509
|
|
510
|
public Class<ICdmIO>[] getIoClassList(){
|
511
|
return ioClassList;
|
512
|
}
|
513
|
|
514
|
|
515
|
/**
|
516
|
* @return the featureMap
|
517
|
*/
|
518
|
public MapWrapper<Feature> getFeatureMap() {
|
519
|
return featureMap;
|
520
|
}
|
521
|
|
522
|
/**
|
523
|
* @param featureMap the featureMap to set
|
524
|
*/
|
525
|
public void setFeatureMap(MapWrapper<Feature> featureMap) {
|
526
|
this.featureMap = featureMap;
|
527
|
}
|
528
|
|
529
|
|
530
|
/**
|
531
|
* Returns a <code>CdmApplicationController</code> created by the values of this configuration.
|
532
|
* If a controller was already created before the last created controller is returned.
|
533
|
* @return
|
534
|
*/
|
535
|
public CdmApplicationController getCdmAppController(){
|
536
|
return getCdmAppController(false);
|
537
|
}
|
538
|
|
539
|
/**
|
540
|
* Returns a new instance of <code>CdmApplicationController</code> created by the values of this configuration.
|
541
|
* @return
|
542
|
*/
|
543
|
public CdmApplicationController getNewCdmAppController(){
|
544
|
return getCdmAppController(true);
|
545
|
}
|
546
|
|
547
|
/**
|
548
|
* Returns a <code>CdmApplicationController</code> created by the values of this configuration.
|
549
|
* If create new is true always a new controller is returned, else the last created controller is returned. If no controller has
|
550
|
* been created before a new controller is returned.
|
551
|
* @return
|
552
|
*/
|
553
|
public CdmApplicationController getCdmAppController(boolean createNew){
|
554
|
if (cdmApp == null || createNew == true){
|
555
|
try {
|
556
|
cdmApp = CdmApplicationController.NewInstance(this.getDestination(), this.getDbSchemaValidation());
|
557
|
} catch (DataSourceNotFoundException e) {
|
558
|
logger.error("could not connect to destination database");
|
559
|
return null;
|
560
|
}catch (TermNotFoundException e) {
|
561
|
logger.error("could not find needed term in destination datasource");
|
562
|
return null;
|
563
|
}
|
564
|
}
|
565
|
return cdmApp;
|
566
|
}
|
567
|
|
568
|
|
569
|
/**
|
570
|
* Returns a <code>CdmApplicationController</code> created by the values of this configuration.
|
571
|
* If create new is true always a new controller is returned, else the last created controller is returned. If no controller has
|
572
|
* been created before a new controller is returned.
|
573
|
* @return
|
574
|
*/
|
575
|
public CdmApplicationController getCdmAppController(boolean createNew, boolean omitTermLoading){
|
576
|
if (cdmApp == null || createNew == true){
|
577
|
try {
|
578
|
cdmApp = CdmApplicationController.NewInstance(this.getDestination(), this.getDbSchemaValidation(), omitTermLoading);
|
579
|
} catch (DataSourceNotFoundException e) {
|
580
|
logger.error("could not connect to destination database");
|
581
|
return null;
|
582
|
}catch (TermNotFoundException e) {
|
583
|
logger.error("could not find needed term in destination datasource");
|
584
|
return null;
|
585
|
}
|
586
|
}
|
587
|
return cdmApp;
|
588
|
}
|
589
|
|
590
|
|
591
|
protected static Method getDefaultFunction(Class<?> clazz, String methodName){
|
592
|
try {
|
593
|
return clazz.getMethod(methodName, List.class) ;
|
594
|
} catch (SecurityException e) {
|
595
|
logger.error(e.getMessage());
|
596
|
e.printStackTrace();
|
597
|
} catch (NoSuchMethodException e) {
|
598
|
logger.error(e.getMessage());
|
599
|
e.printStackTrace();
|
600
|
}
|
601
|
return null;
|
602
|
}
|
603
|
|
604
|
|
605
|
}
|