Revision 748cb818
Added by Andreas Müller about 4 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/caryo/CaryoImportConfigurator.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
13 | 13 |
|
14 | 14 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
15 | 15 |
import eu.etaxonomy.cdm.io.common.DbImportConfiguratorBase; |
16 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator; |
|
17 | 16 |
import eu.etaxonomy.cdm.io.common.Source; |
18 | 17 |
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer; |
19 | 18 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
20 | 19 |
|
21 |
|
|
22 | 20 |
/** |
23 | 21 |
* @author a.mueller |
24 | 22 |
* @since 20.03.2008 |
25 |
* @version 1.0 |
|
26 | 23 |
*/ |
27 |
public class CaryoImportConfigurator extends DbImportConfiguratorBase<CaryoImportState> implements IImportConfigurator{ |
|
28 |
@SuppressWarnings("unused") |
|
24 |
public class CaryoImportConfigurator |
|
25 |
extends DbImportConfiguratorBase<CaryoImportState>{ |
|
26 |
|
|
27 |
private static final long serialVersionUID = 9002177401082394179L; |
|
28 |
@SuppressWarnings("unused") |
|
29 | 29 |
private static Logger logger = Logger.getLogger(CaryoImportConfigurator.class); |
30 | 30 |
|
31 | 31 |
private boolean isDoTaxa; |
32 |
|
|
32 |
|
|
33 | 33 |
private static IInputTransformer defaultTransformer = new CaryoTransformer(); |
34 |
|
|
34 |
|
|
35 | 35 |
public static CaryoImportConfigurator NewInstance(Source source, ICdmDataSource destination){ |
36 | 36 |
return new CaryoImportConfigurator(source, destination); |
37 |
} |
|
38 |
|
|
37 |
} |
|
39 | 38 |
|
40 |
|
|
41 |
protected void makeIoClassList(){ |
|
39 |
@SuppressWarnings("unchecked") |
|
40 |
@Override |
|
41 |
protected void makeIoClassList(){ |
|
42 | 42 |
ioClassList = new Class[]{ |
43 | 43 |
CaryoTaxonImport.class , |
44 |
};
|
|
44 |
}; |
|
45 | 45 |
} |
46 |
|
|
47 | 46 |
|
48 |
/* (non-Javadoc) |
|
49 |
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState() |
|
50 |
*/ |
|
51 |
public CaryoImportState getNewState() { |
|
47 |
@SuppressWarnings("unchecked") |
|
48 |
@Override |
|
49 |
public CaryoImportState getNewState() { |
|
52 | 50 |
return new CaryoImportState(this); |
53 | 51 |
} |
54 | 52 |
|
55 |
|
|
56 |
|
|
57 | 53 |
private CaryoImportConfigurator(Source source, ICdmDataSource destination) { |
58 | 54 |
super(source, destination, NomenclaturalCode.ICNAFP, defaultTransformer); |
59 | 55 |
} |
60 | 56 |
|
61 |
|
|
62 |
|
|
63 | 57 |
public boolean isDoTaxa() { |
64 | 58 |
return this.isDoTaxa; |
65 | 59 |
} |
66 | 60 |
|
67 |
|
|
68 |
|
|
69 | 61 |
public void setDoTaxa(boolean isDoTaxa) { |
70 | 62 |
this.isDoTaxa = isDoTaxa; |
71 | 63 |
} |
72 |
|
|
73 | 64 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/mexico/MexicoBorhidiExcelImport.java | ||
---|---|---|
46 | 46 |
/** |
47 | 47 |
* @author a.mueller |
48 | 48 |
* @since 16.06.2016 |
49 |
* |
|
50 | 49 |
*/ |
51 | 50 |
@Component |
52 | 51 |
public class MexicoBorhidiExcelImport<CONFIG extends MexicoBorhidiImportConfigurator> |
... | ... | |
60 | 59 |
"OutputIssue","OutputPage","OutputTitlePageYear","OutputYearPublished", |
61 | 60 |
"OutputBHLLink"}); |
62 | 61 |
|
63 |
|
|
64 | 62 |
@Override |
65 | 63 |
protected void firstPass(SimpleExcelTaxonImportState<CONFIG> state) { |
66 | 64 |
String line = state.getCurrentLine() + ": "; |
... | ... | |
84 | 82 |
|
85 | 83 |
taxon.addSource(makeOriginalSource(state)); |
86 | 84 |
|
87 |
|
|
88 | 85 |
//make genus |
89 | 86 |
makeGenus(state, speciesName, sec, taxon, rubiaceae); |
90 | 87 |
} |
... | ... | |
92 | 89 |
|
93 | 90 |
private Classification classification; |
94 | 91 |
private TaxonNode rubiaceaeNode; |
95 |
/** |
|
96 |
* @return |
|
97 |
*/ |
|
92 |
|
|
98 | 93 |
private TaxonNode getHighestNode(SimpleExcelTaxonImportState<CONFIG> state) { |
99 | 94 |
if (rubiaceaeNode == null){ |
100 | 95 |
MexicoBorhidiImportConfigurator config = state.getConfig(); |
... | ... | |
110 | 105 |
return rubiaceaeNode; |
111 | 106 |
} |
112 | 107 |
|
113 |
/** |
|
114 |
* @param record |
|
115 |
* @param state |
|
116 |
* @return |
|
117 |
*/ |
|
118 | 108 |
private IBotanicalName makeName(Map<String, String> record, SimpleExcelTaxonImportState<CONFIG> state) { |
119 | 109 |
String line = state.getCurrentLine() + ": "; |
120 | 110 |
|
... | ... | |
255 | 245 |
return name; |
256 | 246 |
} |
257 | 247 |
|
258 |
/** |
|
259 |
* @param outputCollation |
|
260 |
* @return |
|
261 |
*/ |
|
262 | 248 |
private String[] makeVolumeDetail(String outputCollation) { |
263 | 249 |
if (outputCollation == null){ |
264 | 250 |
return new String[0]; |
... | ... | |
268 | 254 |
} |
269 | 255 |
} |
270 | 256 |
|
271 |
/** |
|
272 |
* @param state |
|
273 |
* @param referencedName |
|
274 |
*/ |
|
275 | 257 |
private void addNomRefExtension(SimpleExcelTaxonImportState<CONFIG> state, IBotanicalName name) { |
276 | 258 |
String newExtensionStr = name.getFullTitleCache() + " - BORHIDI"; |
277 | 259 |
UUID uuidNomRefExtension = MexicoConabioTransformer.uuidNomRefExtension; |
... | ... | |
286 | 268 |
ExtensionType extensionType = getExtensionType(state, uuidNomRefExtension, label, label, abbrev); |
287 | 269 |
Extension.NewInstance((TaxonName)name, newExtensionStr, extensionType); |
288 | 270 |
} |
289 |
|
|
290 |
|
|
291 | 271 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/mexico/MexicoBorhidiImportConfigurator.java | ||
---|---|---|
11 | 11 |
import java.net.URI; |
12 | 12 |
|
13 | 13 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
14 |
import eu.etaxonomy.cdm.io.common.ImportStateBase; |
|
15 | 14 |
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer; |
16 | 15 |
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase; |
17 | 16 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
... | ... | |
20 | 19 |
/** |
21 | 20 |
* @author a.mueller |
22 | 21 |
* @since 16.06.2016 |
23 |
* |
|
24 | 22 |
*/ |
25 | 23 |
public class MexicoBorhidiImportConfigurator extends ExcelImportConfiguratorBase{ |
26 | 24 |
private static final long serialVersionUID = -4793138681632122831L; |
... | ... | |
28 | 26 |
private static IInputTransformer defaultTransformer = new MexicoConabioTransformer(); |
29 | 27 |
private Reference secReference; |
30 | 28 |
|
31 |
/** |
|
32 |
* @param source |
|
33 |
* @param cdmDestination |
|
34 |
* @return |
|
35 |
*/ |
|
36 | 29 |
public static MexicoBorhidiImportConfigurator NewInstance(URI source, ICdmDataSource destination) { |
37 | 30 |
return new MexicoBorhidiImportConfigurator(source, destination); |
38 | 31 |
} |
39 | 32 |
|
40 |
|
|
41 | 33 |
private MexicoBorhidiImportConfigurator(URI source, ICdmDataSource destination) { |
42 | 34 |
super(source, destination, defaultTransformer); |
43 | 35 |
setNomenclaturalCode(NomenclaturalCode.ICNAFP); |
... | ... | |
45 | 37 |
setDestination(destination); |
46 | 38 |
} |
47 | 39 |
|
40 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
48 | 41 |
@Override |
49 |
public ImportStateBase getNewState() {
|
|
42 |
public SimpleExcelTaxonImportState getNewState() {
|
|
50 | 43 |
return new SimpleExcelTaxonImportState<>(this); |
51 | 44 |
} |
52 | 45 |
|
46 |
@SuppressWarnings("unchecked") |
|
53 | 47 |
@Override |
54 | 48 |
protected void makeIoClassList() { |
55 | 49 |
ioClassList = new Class[]{ |
... | ... | |
57 | 51 |
}; |
58 | 52 |
} |
59 | 53 |
|
60 |
|
|
61 |
/** |
|
62 |
* @return the secReference |
|
63 |
*/ |
|
64 | 54 |
public Reference getSecReference() { |
65 | 55 |
return secReference; |
66 | 56 |
} |
67 |
|
|
68 |
|
|
69 |
/** |
|
70 |
* @param secReference |
|
71 |
*/ |
|
72 | 57 |
public void setSecReference(Reference secReference) { |
73 | 58 |
this.secReference = secReference; |
74 | 59 |
} |
75 |
|
|
76 |
} |
|
77 |
|
|
60 |
} |
app-import/src/main/java/eu/etaxonomy/cdm/io/mexico/MexicoConabioImportConfigurator.java | ||
---|---|---|
20 | 20 |
/** |
21 | 21 |
* @author a.mueller |
22 | 22 |
* @since 16.06.2016 |
23 |
* |
|
24 | 23 |
*/ |
25 | 24 |
public class MexicoConabioImportConfigurator extends ExcelImportConfiguratorBase{ |
26 | 25 |
private static final long serialVersionUID = -2795059530001736347L; |
... | ... | |
60 | 59 |
}; |
61 | 60 |
} |
62 | 61 |
|
63 |
/** |
|
64 |
* @return the doTaxa |
|
65 |
*/ |
|
66 | 62 |
public boolean isDoTaxa() { |
67 | 63 |
return doTaxa; |
68 | 64 |
} |
69 |
|
|
70 |
/** |
|
71 |
* @param doTaxa the doTaxa to set |
|
72 |
*/ |
|
73 | 65 |
public void setDoTaxa(boolean doTaxa) { |
74 | 66 |
this.doTaxa = doTaxa; |
75 | 67 |
} |
76 | 68 |
|
77 |
/** |
|
78 |
* @return the doDistributions |
|
79 |
*/ |
|
80 | 69 |
public boolean isDoDistributions() { |
81 | 70 |
return doDistributions; |
82 | 71 |
} |
83 |
|
|
84 |
/** |
|
85 |
* @param doDistributions the doDistributions to set |
|
86 |
*/ |
|
87 | 72 |
public void setDoDistributions(boolean doDistributions) { |
88 | 73 |
this.doDistributions = doDistributions; |
89 | 74 |
} |
90 | 75 |
|
91 |
/** |
|
92 |
* @return the doCommonNames |
|
93 |
*/ |
|
94 | 76 |
public boolean isDoCommonNames() { |
95 | 77 |
return doCommonNames; |
96 | 78 |
} |
97 |
|
|
98 |
/** |
|
99 |
* @param doCommonNames the doCommonNames to set |
|
100 |
*/ |
|
101 | 79 |
public void setDoCommonNames(boolean doCommonNames) { |
102 | 80 |
this.doCommonNames = doCommonNames; |
103 | 81 |
} |
104 | 82 |
|
105 |
/** |
|
106 |
* @return the secReference |
|
107 |
*/ |
|
108 | 83 |
public Reference getSecReference() { |
109 | 84 |
return secReference; |
110 | 85 |
} |
111 |
|
|
112 |
|
|
113 |
/** |
|
114 |
* @param secReference |
|
115 |
*/ |
|
116 | 86 |
public void setSecReference(Reference secReference) { |
117 | 87 |
this.secReference = secReference; |
118 | 88 |
} |
Also available in: Unified diff
cleanup