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
|
package eu.etaxonomy.cdm.io.common;
|
10
|
|
11
|
import java.util.ArrayList;
|
12
|
import java.util.Collection;
|
13
|
import java.util.List;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
18
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
19
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
20
|
|
21
|
/**
|
22
|
* @author a.mueller
|
23
|
* @created 02-Jul-2010 13:06:43
|
24
|
*
|
25
|
*/
|
26
|
public class CacheUpdaterConfigurator extends ImportConfiguratorBase<DefaultImportState<CacheUpdaterConfigurator>, Object> implements IImportConfigurator{
|
27
|
@SuppressWarnings("unused")
|
28
|
private static final Logger logger = Logger.getLogger(CacheUpdaterConfigurator.class);
|
29
|
|
30
|
public static CacheUpdaterConfigurator NewInstance(ICdmDataSource destination){
|
31
|
return new CacheUpdaterConfigurator(destination, false);
|
32
|
}
|
33
|
|
34
|
/**
|
35
|
* Returns a new Configurator with all boolean values set to false
|
36
|
* @param allFalse
|
37
|
* @return
|
38
|
*/
|
39
|
public static CacheUpdaterConfigurator NewInstance(ICdmDataSource destination, boolean allFalse){
|
40
|
return new CacheUpdaterConfigurator(destination, allFalse);
|
41
|
}
|
42
|
|
43
|
public static CacheUpdaterConfigurator NewInstance(ICdmDataSource destination, List<Class<? extends IdentifiableEntity>> classList){
|
44
|
CacheUpdaterConfigurator result = new CacheUpdaterConfigurator(destination, false);
|
45
|
result.setClassList(classList);
|
46
|
return result;
|
47
|
}
|
48
|
|
49
|
public static CacheUpdaterConfigurator NewInstance(ICdmDataSource destination, Collection<String> classListNames) throws ClassNotFoundException{
|
50
|
CacheUpdaterConfigurator result = new CacheUpdaterConfigurator(destination, false);
|
51
|
List<Class<? extends IdentifiableEntity>> classList = new ArrayList<Class<? extends IdentifiableEntity>>();
|
52
|
for (String className : classListNames){
|
53
|
Class clazz = Class.forName(className);
|
54
|
classList.add(clazz);
|
55
|
}
|
56
|
result.setClassList(classList);
|
57
|
return result;
|
58
|
}
|
59
|
|
60
|
|
61
|
//DescriptionBase
|
62
|
private boolean doTaxonDescription = true;
|
63
|
private boolean doSpecimenDescription = true;
|
64
|
private boolean doNameDescription = true;
|
65
|
|
66
|
//AgentBase
|
67
|
private boolean doPerson = true;
|
68
|
private boolean doTeam = true;
|
69
|
private boolean doInstitution = true;
|
70
|
|
71
|
//MediaEntities
|
72
|
private boolean doCollection = true;
|
73
|
private boolean doReferenceBase = true;
|
74
|
|
75
|
//SpecimenOrObservationBase
|
76
|
private boolean doFieldObservation = true;
|
77
|
private boolean doDeriveUnit = true;
|
78
|
private boolean doLivingBeing = true;
|
79
|
private boolean doObservation = true;
|
80
|
private boolean doSpecimen = true;
|
81
|
|
82
|
//Media
|
83
|
private boolean doMedia = true;
|
84
|
private boolean doMediaKey = true;
|
85
|
private boolean doFigure = true;
|
86
|
private boolean doPhylogenticTree = true;
|
87
|
|
88
|
|
89
|
//TaxonBase
|
90
|
private boolean doTaxon = true;
|
91
|
private boolean doSynonym = true;
|
92
|
|
93
|
private boolean doSequence = true;
|
94
|
|
95
|
//Names
|
96
|
private boolean doViralName = true;
|
97
|
private boolean doNonViralName = true;
|
98
|
private boolean doBotanicalName = true;
|
99
|
private boolean doZoologicalName = true;
|
100
|
private boolean doCultivarPlantName = true;
|
101
|
|
102
|
private boolean doClassification = true;
|
103
|
|
104
|
//TermBase
|
105
|
private boolean doFeatureTree = true;
|
106
|
private boolean doPolytomousKey = true;
|
107
|
|
108
|
private boolean doTermVocabulary = true;
|
109
|
private boolean doDefinedTermBase = true;
|
110
|
private List<Class<? extends IdentifiableEntity>> classList;
|
111
|
|
112
|
private CacheUpdaterConfigurator(ICdmDataSource destination, boolean allFalse){
|
113
|
super(null);
|
114
|
this.setDestination(destination);
|
115
|
if (allFalse){
|
116
|
//DescriptionBase
|
117
|
doTaxonDescription = false;
|
118
|
doSpecimenDescription = false;
|
119
|
doNameDescription = false;
|
120
|
|
121
|
//AgentBase
|
122
|
doPerson = false;
|
123
|
doTeam = false;
|
124
|
doInstitution = false;
|
125
|
|
126
|
//MediaEntities
|
127
|
doCollection = false;
|
128
|
doReferenceBase = false;
|
129
|
|
130
|
//SpecimenOrObservationBase
|
131
|
doFieldObservation = false;
|
132
|
doDeriveUnit = false;
|
133
|
doLivingBeing = false;
|
134
|
doObservation = false;
|
135
|
doSpecimen = false;
|
136
|
|
137
|
//Media
|
138
|
doMedia = false;
|
139
|
doMediaKey = false;
|
140
|
doFigure = false;
|
141
|
doPhylogenticTree = false;
|
142
|
|
143
|
|
144
|
//TaxonBase
|
145
|
doTaxon = false;
|
146
|
doSynonym = false;
|
147
|
|
148
|
doSequence = false;
|
149
|
|
150
|
//Names
|
151
|
doViralName = false;
|
152
|
doNonViralName = false;
|
153
|
doBotanicalName = false;
|
154
|
doZoologicalName = false;
|
155
|
doCultivarPlantName = false;
|
156
|
|
157
|
doClassification = false;
|
158
|
|
159
|
//TermBase
|
160
|
doFeatureTree = false;
|
161
|
doPolytomousKey = false;
|
162
|
|
163
|
doTermVocabulary = false;
|
164
|
doDefinedTermBase = false;
|
165
|
}
|
166
|
}
|
167
|
|
168
|
|
169
|
|
170
|
// **************** GETTER / SETTER ************************************
|
171
|
|
172
|
|
173
|
public List<Class<? extends IdentifiableEntity>> getClassList(){
|
174
|
return this.classList;
|
175
|
}
|
176
|
private void setClassList(List<Class<? extends IdentifiableEntity>> classList) {
|
177
|
this.classList = classList;
|
178
|
}
|
179
|
|
180
|
|
181
|
public void setDoTaxonDescription(boolean doTaxonDescription) {
|
182
|
this.doTaxonDescription = doTaxonDescription;
|
183
|
}
|
184
|
public boolean isDoTaxonDescription() {
|
185
|
return doTaxonDescription;
|
186
|
}
|
187
|
public void setDoSpecimenDescription(boolean doSpecimenDescription) {
|
188
|
this.doSpecimenDescription = doSpecimenDescription;
|
189
|
}
|
190
|
public boolean isDoSpecimenDescription() {
|
191
|
return doSpecimenDescription;
|
192
|
}
|
193
|
public void setDoNameDescription(boolean doNameDescription) {
|
194
|
this.doNameDescription = doNameDescription;
|
195
|
}
|
196
|
public boolean isDoNameDescription() {
|
197
|
return doNameDescription;
|
198
|
}
|
199
|
public void setDoPerson(boolean doPerson) {
|
200
|
this.doPerson = doPerson;
|
201
|
}
|
202
|
public boolean isDoPerson() {
|
203
|
return doPerson;
|
204
|
}
|
205
|
public void setDoTeam(boolean doTeam) {
|
206
|
this.doTeam = doTeam;
|
207
|
}
|
208
|
public boolean isDoTeam() {
|
209
|
return doTeam;
|
210
|
}
|
211
|
public void setDoInstitution(boolean doInstitution) {
|
212
|
this.doInstitution = doInstitution;
|
213
|
}
|
214
|
public boolean isDoInstitution() {
|
215
|
return doInstitution;
|
216
|
}
|
217
|
public void setDoCollection(boolean doCollection) {
|
218
|
this.doCollection = doCollection;
|
219
|
}
|
220
|
public boolean isDoCollection() {
|
221
|
return doCollection;
|
222
|
}
|
223
|
public void setDoReferenceBase(boolean doReferenceBase) {
|
224
|
this.doReferenceBase = doReferenceBase;
|
225
|
}
|
226
|
public boolean isDoReferenceBase() {
|
227
|
return doReferenceBase;
|
228
|
}
|
229
|
public void setDoFieldObservation(boolean doFieldObservation) {
|
230
|
this.doFieldObservation = doFieldObservation;
|
231
|
}
|
232
|
public boolean isDoFieldObservation() {
|
233
|
return doFieldObservation;
|
234
|
}
|
235
|
public void setDoDeriveUnit(boolean doDeriveUnit) {
|
236
|
this.doDeriveUnit = doDeriveUnit;
|
237
|
}
|
238
|
public boolean isDoDeriveUnit() {
|
239
|
return doDeriveUnit;
|
240
|
}
|
241
|
public void setDoLivingBeing(boolean doLivingBeing) {
|
242
|
this.doLivingBeing = doLivingBeing;
|
243
|
}
|
244
|
public boolean isDoLivingBeing() {
|
245
|
return doLivingBeing;
|
246
|
}
|
247
|
public void setDoObservation(boolean doObservation) {
|
248
|
this.doObservation = doObservation;
|
249
|
}
|
250
|
public boolean isDoObservation() {
|
251
|
return doObservation;
|
252
|
}
|
253
|
public void setDoSpecimen(boolean doSpecimen) {
|
254
|
this.doSpecimen = doSpecimen;
|
255
|
}
|
256
|
public boolean isDoSpecimen() {
|
257
|
return doSpecimen;
|
258
|
}
|
259
|
public void setDoMedia(boolean doMedia) {
|
260
|
this.doMedia = doMedia;
|
261
|
}
|
262
|
public boolean isDoMedia() {
|
263
|
return doMedia;
|
264
|
}
|
265
|
public void setDoMediaKey(boolean doMediaKey) {
|
266
|
this.doMediaKey = doMediaKey;
|
267
|
}
|
268
|
public boolean isDoMediaKey() {
|
269
|
return doMediaKey;
|
270
|
}
|
271
|
public void setDoFigure(boolean doFigure) {
|
272
|
this.doFigure = doFigure;
|
273
|
}
|
274
|
public boolean isDoFigure() {
|
275
|
return doFigure;
|
276
|
}
|
277
|
public void setDoPhylogenticTree(boolean doPhylogenticTree) {
|
278
|
this.doPhylogenticTree = doPhylogenticTree;
|
279
|
}
|
280
|
public boolean isDoPhylogenticTree() {
|
281
|
return doPhylogenticTree;
|
282
|
}
|
283
|
public void setDoTaxon(boolean doTaxon) {
|
284
|
this.doTaxon = doTaxon;
|
285
|
}
|
286
|
public boolean isDoTaxon() {
|
287
|
return doTaxon;
|
288
|
}
|
289
|
public void setDoSynonym(boolean doSynonym) {
|
290
|
this.doSynonym = doSynonym;
|
291
|
}
|
292
|
public boolean isDoSynonym() {
|
293
|
return doSynonym;
|
294
|
}
|
295
|
public void setDoSequence(boolean doSequence) {
|
296
|
this.doSequence = doSequence;
|
297
|
}
|
298
|
public boolean isDoSequence() {
|
299
|
return doSequence;
|
300
|
}
|
301
|
public void setDoViralName(boolean doViralName) {
|
302
|
this.doViralName = doViralName;
|
303
|
}
|
304
|
public boolean isDoViralName() {
|
305
|
return doViralName;
|
306
|
}
|
307
|
public void setDoNonViralName(boolean doNonViralName) {
|
308
|
this.doNonViralName = doNonViralName;
|
309
|
}
|
310
|
public boolean isDoNonViralName() {
|
311
|
return doNonViralName;
|
312
|
}
|
313
|
public void setDoBotanicalName(boolean doBotanicalName) {
|
314
|
this.doBotanicalName = doBotanicalName;
|
315
|
}
|
316
|
public boolean isDoBotanicalName() {
|
317
|
return doBotanicalName;
|
318
|
}
|
319
|
public void setDoZoologicalName(boolean doZoologicalName) {
|
320
|
this.doZoologicalName = doZoologicalName;
|
321
|
}
|
322
|
public boolean isDoZoologicalName() {
|
323
|
return doZoologicalName;
|
324
|
}
|
325
|
public void setDoCultivarPlantName(boolean doCultivarPlantName) {
|
326
|
this.doCultivarPlantName = doCultivarPlantName;
|
327
|
}
|
328
|
public boolean isDoCultivarPlantName() {
|
329
|
return doCultivarPlantName;
|
330
|
}
|
331
|
public void setDoClassification(boolean doClassification) {
|
332
|
this.doClassification = doClassification;
|
333
|
}
|
334
|
public boolean isDoClassification() {
|
335
|
return doClassification;
|
336
|
}
|
337
|
public void setDoFeatureTree(boolean doFeatureTree) {
|
338
|
this.doFeatureTree = doFeatureTree;
|
339
|
}
|
340
|
public boolean isDoFeatureTree() {
|
341
|
return doFeatureTree;
|
342
|
}
|
343
|
public void setDoPolytomousKey(boolean doPolytomousKey) {
|
344
|
this.doPolytomousKey = doPolytomousKey;
|
345
|
}
|
346
|
public boolean isDoPolytomousKey() {
|
347
|
return doPolytomousKey;
|
348
|
}
|
349
|
public void setDoTermVocabulary(boolean doTermVocabulary) {
|
350
|
this.doTermVocabulary = doTermVocabulary;
|
351
|
}
|
352
|
public boolean isDoTermVocabulary() {
|
353
|
return doTermVocabulary;
|
354
|
}
|
355
|
public void setDoDefinedTermBase(boolean doDefinedTermBase) {
|
356
|
this.doDefinedTermBase = doDefinedTermBase;
|
357
|
}
|
358
|
public boolean isDoDefinedTermBase() {
|
359
|
return doDefinedTermBase;
|
360
|
}
|
361
|
|
362
|
@Override
|
363
|
public Reference getSourceReference() {
|
364
|
//not needed here
|
365
|
return null;
|
366
|
}
|
367
|
|
368
|
@Override
|
369
|
protected void makeIoClassList() {
|
370
|
ioClassList = new Class[]{
|
371
|
CacheUpdater.class
|
372
|
};
|
373
|
}
|
374
|
|
375
|
@Override
|
376
|
public <STATE extends ImportStateBase> STATE getNewState() {
|
377
|
return (STATE) new DefaultImportState(this);
|
378
|
}
|
379
|
|
380
|
@Override
|
381
|
public boolean isValid() {
|
382
|
//as no source needs to exist
|
383
|
return true;
|
384
|
}
|
385
|
|
386
|
@Override
|
387
|
public String getSourceNameString() {
|
388
|
//not needed here
|
389
|
return null;
|
390
|
}
|
391
|
|
392
|
|
393
|
|
394
|
|
395
|
}
|