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.taxonx2013;
|
11
|
|
12
|
import java.net.URI;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
|
16
|
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
|
17
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
18
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
19
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
20
|
|
21
|
|
22
|
/**
|
23
|
* @author a.mueller
|
24
|
* @created 29.07.2008
|
25
|
* @version 1.0
|
26
|
*/
|
27
|
public class TaxonXImportConfigurator extends ImportConfiguratorBase<TaxonXImportState, URI> implements IImportConfigurator {
|
28
|
// private static final Logger logger = Logger.getLogger(TaxonXImportConfigurator.class);
|
29
|
|
30
|
//if true the information in the mods part (taxonxHeader)
|
31
|
private boolean doMods = true;
|
32
|
private boolean doFacts = true;
|
33
|
private boolean doTypes = true;
|
34
|
|
35
|
|
36
|
//TODO
|
37
|
private static IInputTransformer defaultTransformer = null;
|
38
|
|
39
|
|
40
|
//if false references in this rdf file are not published in the bibliography list
|
41
|
private boolean isPublishReferences = true;
|
42
|
|
43
|
private String originalSourceTaxonNamespace = "TaxonConcept";
|
44
|
private String originalSourceId;
|
45
|
|
46
|
private static Reference<?> sourceRef = null;
|
47
|
|
48
|
@SuppressWarnings("unchecked")
|
49
|
@Override
|
50
|
protected void makeIoClassList(){
|
51
|
ioClassList = new Class[]{
|
52
|
TaxonXImport.class,
|
53
|
};
|
54
|
}
|
55
|
|
56
|
/**
|
57
|
* @param uri
|
58
|
* @param destination
|
59
|
* @return
|
60
|
*/
|
61
|
public static TaxonXImportConfigurator NewInstance(URI uri, ICdmDataSource destination){
|
62
|
return new TaxonXImportConfigurator(uri, destination);
|
63
|
}
|
64
|
|
65
|
|
66
|
/**
|
67
|
* @param url
|
68
|
* @param destination
|
69
|
*/
|
70
|
private TaxonXImportConfigurator(URI uri, ICdmDataSource destination) {
|
71
|
super(defaultTransformer);
|
72
|
setSource(uri);
|
73
|
setDestination(destination);
|
74
|
}
|
75
|
|
76
|
/**
|
77
|
* @param url
|
78
|
* @param destination
|
79
|
*/
|
80
|
private TaxonXImportConfigurator(ICdmDataSource destination) {
|
81
|
super(defaultTransformer);
|
82
|
setDestination(destination);
|
83
|
}
|
84
|
|
85
|
|
86
|
|
87
|
/* (non-Javadoc)
|
88
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
89
|
*/
|
90
|
@SuppressWarnings("unchecked")
|
91
|
@Override
|
92
|
public TaxonXImportState getNewState() {
|
93
|
return new TaxonXImportState(this);
|
94
|
}
|
95
|
|
96
|
/* (non-Javadoc)
|
97
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
98
|
*/
|
99
|
@SuppressWarnings("rawtypes")
|
100
|
@Override
|
101
|
public Reference getSourceReference() {
|
102
|
if (sourceReference == null){
|
103
|
sourceReference = ReferenceFactory.newGeneric();
|
104
|
|
105
|
if (getSourceRefUuid() != null){
|
106
|
sourceReference.setUuid(getSourceRefUuid());
|
107
|
}
|
108
|
if (sourceRef != null){
|
109
|
sourceReference.setTitleCache(sourceRef.getTitleCache(), true);
|
110
|
}
|
111
|
}
|
112
|
return sourceReference;
|
113
|
}
|
114
|
|
115
|
|
116
|
/* (non-Javadoc)
|
117
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
118
|
*/
|
119
|
@Override
|
120
|
public String getSourceNameString() {
|
121
|
if (this.getSource() == null){
|
122
|
return null;
|
123
|
}else{
|
124
|
return this.getSource().toString();
|
125
|
}
|
126
|
}
|
127
|
|
128
|
public String getOriginalSourceTaxonNamespace() {
|
129
|
return originalSourceTaxonNamespace;
|
130
|
}
|
131
|
|
132
|
public void setOriginalSourceTaxonNamespace(String originalSourceTaxonNamespace) {
|
133
|
this.originalSourceTaxonNamespace = originalSourceTaxonNamespace;
|
134
|
}
|
135
|
|
136
|
public String getOriginalSourceId() {
|
137
|
return originalSourceId;
|
138
|
}
|
139
|
|
140
|
public void setOriginalSourceId(String originalSourceId) {
|
141
|
this.originalSourceId = originalSourceId;
|
142
|
}
|
143
|
|
144
|
|
145
|
/**
|
146
|
* @return the doMods
|
147
|
*/
|
148
|
public boolean isDoMods() {
|
149
|
return doMods;
|
150
|
}
|
151
|
|
152
|
/**
|
153
|
* @param doMods the doMods to set
|
154
|
*/
|
155
|
public void setDoMods(boolean doMods) {
|
156
|
this.doMods = doMods;
|
157
|
}
|
158
|
|
159
|
|
160
|
public boolean isDoFacts() {
|
161
|
return doFacts;
|
162
|
}
|
163
|
public void setDoFacts(boolean doFacts) {
|
164
|
this.doFacts = doFacts;
|
165
|
}
|
166
|
|
167
|
|
168
|
|
169
|
public boolean isDoTypes() {
|
170
|
return doTypes;
|
171
|
}
|
172
|
public void setDoTypes(boolean doTypes) {
|
173
|
this.doTypes = doTypes;
|
174
|
}
|
175
|
|
176
|
|
177
|
/**
|
178
|
* @return the isPublishReferences
|
179
|
*/
|
180
|
public boolean isPublishReferences() {
|
181
|
return isPublishReferences;
|
182
|
}
|
183
|
|
184
|
/**
|
185
|
* @param isPublishReferences the isPublishReferences to set
|
186
|
*/
|
187
|
public void setPublishReferences(boolean isPublishReferences) {
|
188
|
this.isPublishReferences = isPublishReferences;
|
189
|
}
|
190
|
|
191
|
/**
|
192
|
* @param b
|
193
|
*/
|
194
|
public void setDoAutomaticParsing(boolean b) {
|
195
|
|
196
|
}
|
197
|
|
198
|
/**
|
199
|
* @param destination
|
200
|
* @return
|
201
|
*/
|
202
|
public static TaxonXImportConfigurator NewInstance(ICdmDataSource destination) {
|
203
|
return new TaxonXImportConfigurator(destination);
|
204
|
}
|
205
|
|
206
|
/**
|
207
|
* @param reference
|
208
|
*/
|
209
|
public static void setSourceRef(Reference<?> reference) {
|
210
|
sourceRef = reference;
|
211
|
|
212
|
}
|
213
|
|
214
|
|
215
|
}
|