1
|
/**
|
2
|
* Copyright (C) 2008 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.faunaEuropaea;
|
10
|
|
11
|
import org.apache.log4j.Logger;
|
12
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
13
|
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
|
14
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
|
15
|
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
|
16
|
import eu.etaxonomy.cdm.io.common.ImportStateBase;
|
17
|
import eu.etaxonomy.cdm.io.common.Source;
|
18
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
19
|
import eu.etaxonomy.cdm.model.reference.IDatabase;
|
20
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
21
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
22
|
|
23
|
/**
|
24
|
* @author a.babadshanjan
|
25
|
* @created 22.09.2009
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class CdmImportConfigurator extends ImportConfiguratorBase<CdmImportState> implements IImportConfigurator {
|
29
|
|
30
|
private static final Logger logger = Logger.getLogger(CdmImportConfigurator.class);
|
31
|
|
32
|
private boolean doHeterotypicSynonymsForBasionyms = true;
|
33
|
private int limitSave = 1000;
|
34
|
|
35
|
@SuppressWarnings("unchecked")
|
36
|
protected void makeIoClassList() {
|
37
|
ioClassList = new Class[] {
|
38
|
FaunaEuropaeaHeterotypicSynonymImport.class
|
39
|
};
|
40
|
};
|
41
|
|
42
|
public static CdmImportConfigurator NewInstance(Source source, ICdmDataSource destination){
|
43
|
return new CdmImportConfigurator(source, destination);
|
44
|
}
|
45
|
|
46
|
private CdmImportConfigurator(Source source, ICdmDataSource destination) {
|
47
|
setSource(source);
|
48
|
setDestination(destination);
|
49
|
setNomenclaturalCode(NomenclaturalCode.ICBN);
|
50
|
}
|
51
|
|
52
|
public static CdmImportConfigurator NewInstance(ICdmDataSource source, ICdmDataSource destination){
|
53
|
return new CdmImportConfigurator(source, destination);
|
54
|
}
|
55
|
|
56
|
private CdmImportConfigurator(ICdmDataSource source, ICdmDataSource destination) {
|
57
|
setSource(source);
|
58
|
setDestination(destination);
|
59
|
setNomenclaturalCode(NomenclaturalCode.ICBN);
|
60
|
}
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
|
64
|
*/
|
65
|
public ICdmDataSource getSource() {
|
66
|
return (ICdmDataSource)super.getSource();
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
* @param dbSource
|
71
|
*/
|
72
|
public void setSource(ICdmDataSource source) {
|
73
|
super.setSource(source);
|
74
|
}
|
75
|
|
76
|
// public ICdmDataSource getSource() {
|
77
|
// return source;
|
78
|
// }
|
79
|
//
|
80
|
// public void setSource(ICdmDataSource source) {
|
81
|
// this.source = source;
|
82
|
// }
|
83
|
|
84
|
/* (non-Javadoc)
|
85
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
86
|
*/
|
87
|
@Override
|
88
|
public ReferenceBase<?> getSourceReference() {
|
89
|
//TODO
|
90
|
if (this.sourceReference == null){
|
91
|
logger.warn("getSource Reference not yet fully implemented");
|
92
|
ReferenceFactory refFactory = ReferenceFactory.newInstance();
|
93
|
sourceReference = refFactory.newDatabase();
|
94
|
sourceReference.setTitleCache("Fauna Europaea database");
|
95
|
}
|
96
|
return sourceReference;
|
97
|
}
|
98
|
|
99
|
|
100
|
/* (non-Javadoc)
|
101
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
102
|
*/
|
103
|
public String getSourceNameString() {
|
104
|
if (this.getSource() == null) {
|
105
|
return null;
|
106
|
}else{
|
107
|
return this.getSource().toString();
|
108
|
}
|
109
|
}
|
110
|
|
111
|
/* (non-Javadoc)
|
112
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
113
|
*/
|
114
|
public CdmImportState getNewState() {
|
115
|
return new CdmImportState(this);
|
116
|
}
|
117
|
|
118
|
/**
|
119
|
* @return the limitSave
|
120
|
*/
|
121
|
public int getLimitSave() {
|
122
|
return limitSave;
|
123
|
}
|
124
|
|
125
|
/**
|
126
|
* @param limitSave the limitSave to set
|
127
|
*/
|
128
|
public void setLimitSave(int limitSave) {
|
129
|
this.limitSave = limitSave;
|
130
|
}
|
131
|
|
132
|
/**
|
133
|
* @return the doHeterotypicSynonymsForBasionyms
|
134
|
*/
|
135
|
public boolean isDoHeterotypicSynonymsForBasionyms() {
|
136
|
return doHeterotypicSynonymsForBasionyms;
|
137
|
}
|
138
|
|
139
|
/**
|
140
|
* @param doHeterotypicSynonymsForBasionyms the doHeterotypicSynonymsForBasionyms to set
|
141
|
*/
|
142
|
public void setDoHeterotypicSynonymsForBasionyms(
|
143
|
boolean doHeterotypicSynonymsForBasionyms) {
|
144
|
this.doHeterotypicSynonymsForBasionyms = doHeterotypicSynonymsForBasionyms;
|
145
|
}
|
146
|
|
147
|
}
|