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.specimen.abcd206;
|
11
|
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
16
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
|
17
|
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
|
18
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
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 p.kelbert
|
25
|
* @created 20.10.2008
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class SpecimenImportConfigurator extends ImportConfiguratorBase<SpecimenImportState> implements IImportConfigurator {
|
29
|
private static final Logger logger = Logger.getLogger(SpecimenImportConfigurator.class);
|
30
|
private boolean doParsing = false;
|
31
|
private boolean reuseMetadata = false;
|
32
|
private boolean reuseTaxon = false;
|
33
|
private String taxonReference = null;
|
34
|
|
35
|
|
36
|
//TODO
|
37
|
private static IInputTransformer defaultTransformer = null;
|
38
|
|
39
|
|
40
|
@SuppressWarnings("unchecked")
|
41
|
protected void makeIoClassList(){
|
42
|
System.out.println("makeIOClassList");
|
43
|
ioClassList = new Class[]{
|
44
|
AbcdIO.class,
|
45
|
};
|
46
|
};
|
47
|
|
48
|
public static SpecimenImportConfigurator NewInstance(String url,
|
49
|
ICdmDataSource destination){
|
50
|
return new SpecimenImportConfigurator(url, destination);
|
51
|
}
|
52
|
|
53
|
|
54
|
/**
|
55
|
* @param berlinModelSource
|
56
|
* @param sourceReference
|
57
|
* @param destination
|
58
|
*/
|
59
|
private SpecimenImportConfigurator(String url, ICdmDataSource destination) {
|
60
|
super(defaultTransformer);
|
61
|
setSource(url);
|
62
|
setDestination(destination);
|
63
|
}
|
64
|
|
65
|
|
66
|
|
67
|
|
68
|
// /* (non-Javadoc)
|
69
|
// * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
|
70
|
// */
|
71
|
// public String getSource() {
|
72
|
// return (String)super.getSource();
|
73
|
// }
|
74
|
|
75
|
/* (non-Javadoc)
|
76
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
77
|
*/
|
78
|
public SpecimenImportState getNewState() {
|
79
|
return new SpecimenImportState(this);
|
80
|
}
|
81
|
|
82
|
public String getSource(){
|
83
|
return (String)super.getSource();
|
84
|
}
|
85
|
|
86
|
/**
|
87
|
* @param file
|
88
|
*/
|
89
|
public void setSource(String file) {
|
90
|
super.setSource(file);
|
91
|
}
|
92
|
|
93
|
|
94
|
|
95
|
/* (non-Javadoc)
|
96
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
97
|
*/
|
98
|
@Override
|
99
|
public ReferenceBase getSourceReference() {
|
100
|
//TODO
|
101
|
if (this.sourceReference == null){
|
102
|
logger.warn("getSource Reference not yet fully implemented");
|
103
|
ReferenceFactory refFactory = ReferenceFactory.newInstance();
|
104
|
sourceReference = refFactory.newDatabase();
|
105
|
sourceReference.setTitleCache("ABCD specimen import", true);
|
106
|
}
|
107
|
return sourceReference;
|
108
|
}
|
109
|
|
110
|
public void setTaxonReference(String taxonReference) {
|
111
|
this.taxonReference = taxonReference;
|
112
|
}
|
113
|
|
114
|
public ReferenceBase getTaxonReference() {
|
115
|
//TODO
|
116
|
if (this.taxonReference == null){
|
117
|
logger.info("getTaxonReference not yet fully implemented");
|
118
|
}
|
119
|
return sourceReference;
|
120
|
}
|
121
|
|
122
|
|
123
|
/* (non-Javadoc)
|
124
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
125
|
*/
|
126
|
public String getSourceNameString() {
|
127
|
if (this.getSource() == null){
|
128
|
return null;
|
129
|
}else{
|
130
|
return (String)this.getSource();
|
131
|
}
|
132
|
}
|
133
|
|
134
|
public void setDoAutomaticParsing(boolean doParsing){
|
135
|
this.doParsing=doParsing;
|
136
|
}
|
137
|
|
138
|
public boolean getDoAutomaticParsing(){
|
139
|
return this.doParsing;
|
140
|
}
|
141
|
|
142
|
public void setReUseExistingMetadata(boolean reuseMetadata){
|
143
|
this.reuseMetadata = reuseMetadata;
|
144
|
}
|
145
|
|
146
|
public boolean getReUseExistingMetadata(){
|
147
|
return this.reuseMetadata;
|
148
|
}
|
149
|
|
150
|
public void setReUseTaxon(boolean reuseTaxon){
|
151
|
this.reuseTaxon = reuseTaxon;
|
152
|
}
|
153
|
|
154
|
public boolean getDoReUseTaxon(){
|
155
|
return this.reuseTaxon;
|
156
|
}
|
157
|
|
158
|
|
159
|
}
|