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.cuba;
|
11
|
|
12
|
import java.net.URI;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
18
|
import eu.etaxonomy.cdm.io.common.ImportStateBase;
|
19
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
20
|
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
|
21
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
22
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
23
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
24
|
|
25
|
|
26
|
/**
|
27
|
* @author a.mueller
|
28
|
* @created 20.03.2008
|
29
|
*/
|
30
|
public class CubaImportConfigurator extends ExcelImportConfiguratorBase {
|
31
|
|
32
|
private static final long serialVersionUID = 5590553979984931651L;
|
33
|
|
34
|
@SuppressWarnings("unused")
|
35
|
private static Logger logger = Logger.getLogger(CubaImportConfigurator.class);
|
36
|
|
37
|
private String cubaReferenceTitle;
|
38
|
|
39
|
private UUID uuidCyprusReference = UUID.fromString("b5281cd3-9d5d-4ae2-8d55-b62a592ce846");
|
40
|
|
41
|
private boolean isDoTaxa;
|
42
|
|
43
|
private boolean doVocabularies;
|
44
|
public void setDoVocabularies(boolean doVocabularies) {this.doVocabularies = doVocabularies;}
|
45
|
public boolean isDoVocabularies() {return doVocabularies;}
|
46
|
|
47
|
private static IInputTransformer defaultTransformer = new CubaTransformer();
|
48
|
|
49
|
public static CubaImportConfigurator NewInstance(URI source, ICdmDataSource destination){
|
50
|
return new CubaImportConfigurator(source, destination);
|
51
|
}
|
52
|
|
53
|
@Override
|
54
|
protected void makeIoClassList(){
|
55
|
ioClassList = new Class[]{
|
56
|
CubaVocabularyImport.class,
|
57
|
CubaExcelImport.class
|
58
|
};
|
59
|
}
|
60
|
|
61
|
@Override
|
62
|
public ImportStateBase getNewState() {
|
63
|
return new CubaImportState(this);
|
64
|
}
|
65
|
|
66
|
|
67
|
|
68
|
private CubaImportConfigurator(URI source, ICdmDataSource destination) {
|
69
|
super(source, destination, defaultTransformer);
|
70
|
setNomenclaturalCode(NomenclaturalCode.ICNAFP);
|
71
|
setSource(source);
|
72
|
setDestination(destination);
|
73
|
}
|
74
|
|
75
|
|
76
|
@Override
|
77
|
public URI getSource() {
|
78
|
return super.getSource();
|
79
|
}
|
80
|
@Override
|
81
|
public void setSource(URI source) {
|
82
|
super.setSource(source);
|
83
|
}
|
84
|
|
85
|
@Override
|
86
|
public Reference getSourceReference() {
|
87
|
if (sourceReference == null){
|
88
|
sourceReference = ReferenceFactory.newDatabase();
|
89
|
if (getSource() != null){
|
90
|
sourceReference.setTitleCache(getCubaReferenceTitle(), true);
|
91
|
}
|
92
|
}
|
93
|
return sourceReference;
|
94
|
}
|
95
|
|
96
|
@Override
|
97
|
public String getSourceNameString() {
|
98
|
return getSource().toString();
|
99
|
}
|
100
|
|
101
|
|
102
|
public void setUuidCyprusReference(UUID uuidCyprusReference) {
|
103
|
this.uuidCyprusReference = uuidCyprusReference;
|
104
|
}
|
105
|
|
106
|
|
107
|
public UUID getUuidCyprusReference() {
|
108
|
return uuidCyprusReference;
|
109
|
}
|
110
|
|
111
|
|
112
|
public void setCubaReferenceTitle(String cyprusReferenceTitle) {
|
113
|
this.cubaReferenceTitle = cyprusReferenceTitle;
|
114
|
}
|
115
|
|
116
|
|
117
|
public String getCubaReferenceTitle() {
|
118
|
return cubaReferenceTitle;
|
119
|
}
|
120
|
|
121
|
public void setDoTaxa(boolean isDoTaxa) {
|
122
|
this.isDoTaxa = isDoTaxa;
|
123
|
}
|
124
|
|
125
|
public boolean isDoTaxa() {
|
126
|
return isDoTaxa;
|
127
|
}
|
128
|
|
129
|
|
130
|
|
131
|
}
|