Revision 60451921
Added by Andreas Müller about 3 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelFormatAnalyzer.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2020 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.fact.temporal.in; |
|
10 |
|
|
11 |
/** |
|
12 |
* Analyzer for taxon based phenology import. |
|
13 |
* |
|
14 |
* TODO not yet implemented |
|
15 |
* |
|
16 |
* @author a.mueller |
|
17 |
* @since 15.07.2020 |
|
18 |
*/ |
|
19 |
public class PhenologyExcelFormatAnalyzer |
|
20 |
extends TemporalDataExcelFormatAnalyzer<PhenologyExcelImportConfigurator> { |
|
21 |
|
|
22 |
protected PhenologyExcelFormatAnalyzer(PhenologyExcelImportConfigurator config) { |
|
23 |
super(config, requiredWorksheets(), requiredColumns(), optionalColumns(), optionalMultiColumns()); |
|
24 |
} |
|
25 |
|
|
26 |
private static String[] requiredWorksheets() { |
|
27 |
return new String[]{"Data","Vocabulary"}; |
|
28 |
} |
|
29 |
|
|
30 |
private static String[] requiredColumns() { |
|
31 |
return new String[]{"taxonUuid", "xxx", "xxx"}; |
|
32 |
} |
|
33 |
|
|
34 |
private static String[] optionalColumns() { |
|
35 |
return new String[]{"nameCache", "nameFullCache"}; |
|
36 |
} |
|
37 |
private static String[] optionalMultiColumns() { |
|
38 |
return new String[]{}; |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImport.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.fact.temporal.in; |
|
10 |
|
|
11 |
import java.util.Map; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.springframework.stereotype.Component; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
17 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
18 |
|
|
19 |
/** |
|
20 |
* Import for taxon based phenology data. |
|
21 |
* |
|
22 |
* @author a.mueller |
|
23 |
* @since 15.07.2020 |
|
24 |
*/ |
|
25 |
@Component |
|
26 |
public class PhenologyExcelImport |
|
27 |
extends TemporalDataExcelImport<PhenologyExcelImportState, PhenologyExcelImportConfigurator>{ |
|
28 |
|
|
29 |
private static final long serialVersionUID = 1050528888222978429L; |
|
30 |
|
|
31 |
public static final String FLOWERING_START = "Flowering start"; |
|
32 |
public static final String FLOWERING_END = "Flowering end"; |
|
33 |
public static final String FRUITING_START = "Fruiting start"; |
|
34 |
public static final String FRUITING_END = "Fruiting end"; |
|
35 |
|
|
36 |
@Override |
|
37 |
protected void doFirstPass(PhenologyExcelImportState state, Taxon taxon, |
|
38 |
String line, String linePure){ |
|
39 |
|
|
40 |
super.doFirstPass(state, taxon, line, linePure); |
|
41 |
|
|
42 |
if (taxon == null){ |
|
43 |
// return; |
|
44 |
taxon = Taxon.NewInstance(null, null); |
|
45 |
} |
|
46 |
|
|
47 |
Map<String, String> record = state.getOriginalRecord(); |
|
48 |
|
|
49 |
UUID uuidFeatureFruiting = state.getConfig().getFruitingFeatureUuid(); |
|
50 |
Feature featureFruiting = (Feature)getTermService().find(uuidFeatureFruiting); |
|
51 |
String colFruitingStart = state.getConfig().getFruitingStartColumnLabel(); |
|
52 |
String colFruitingEnd = state.getConfig().getFruitingEndColumnLabel(); |
|
53 |
|
|
54 |
handleFeature(state, taxon, line, linePure, record, featureFruiting, colFruitingStart, colFruitingEnd); |
|
55 |
} |
|
56 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportConfigurator.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.fact.temporal.in; |
|
10 |
|
|
11 |
import java.net.URI; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
|
15 |
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer; |
|
16 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
17 |
|
|
18 |
/** |
|
19 |
* Configurator for taxon based phenology import. |
|
20 |
* |
|
21 |
* @author a.mueller |
|
22 |
* @since 15.07.2020 |
|
23 |
*/ |
|
24 |
public class PhenologyExcelImportConfigurator |
|
25 |
extends TemporalDataExcelImportConfigurator<PhenologyExcelFormatAnalyzer>{ |
|
26 |
|
|
27 |
private static final long serialVersionUID = 2413575026028295925L; |
|
28 |
|
|
29 |
private String floweringStartColumnLabel = PhenologyExcelImport.FLOWERING_START; |
|
30 |
private String floweringEndColumnLabel = PhenologyExcelImport.FLOWERING_END; |
|
31 |
private String fruitingStartColumnLabel = PhenologyExcelImport.FRUITING_START; |
|
32 |
private String fruitingEndColumnLabel = PhenologyExcelImport.FRUITING_END; |
|
33 |
|
|
34 |
public static PhenologyExcelImportConfigurator NewInstance(URI uri, ICdmDataSource destination){ |
|
35 |
return new PhenologyExcelImportConfigurator(uri, destination, null); |
|
36 |
} |
|
37 |
|
|
38 |
private PhenologyExcelImportConfigurator(URI uri, ICdmDataSource destination, IInputTransformer transformer) { |
|
39 |
super(uri, destination, transformer); |
|
40 |
} |
|
41 |
|
|
42 |
@SuppressWarnings("unchecked") |
|
43 |
@Override |
|
44 |
public PhenologyExcelImportState getNewState() { |
|
45 |
return new PhenologyExcelImportState(this); |
|
46 |
} |
|
47 |
|
|
48 |
@SuppressWarnings("unchecked") |
|
49 |
@Override |
|
50 |
protected void makeIoClassList() { |
|
51 |
ioClassList = new Class[]{ |
|
52 |
PhenologyExcelImport.class, |
|
53 |
}; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public PhenologyExcelFormatAnalyzer getAnalyzer() { |
|
58 |
return new PhenologyExcelFormatAnalyzer(this); |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
//Used for flowering uuid |
|
63 |
public UUID getFeatureUuid() { |
|
64 |
return Feature.uuidFloweringPeriod; |
|
65 |
} |
|
66 |
|
|
67 |
public UUID getFruitingFeatureUuid() { |
|
68 |
return Feature.uuidFruitingPeriod; |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
@Deprecated |
|
73 |
public String getColumnLabelStart() { |
|
74 |
return getFloweringStartColumnLabel(); |
|
75 |
} |
|
76 |
@Override |
|
77 |
@Deprecated |
|
78 |
public void setColumnLabelStart(String columnLabelStart) { |
|
79 |
setFloweringStartColumnLabel(columnLabelStart); |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
@Deprecated |
|
84 |
public String getColumnLabelEnd() { |
|
85 |
return getFloweringEndColumnLabel(); |
|
86 |
} |
|
87 |
@Override |
|
88 |
@Deprecated |
|
89 |
public void setColumnLabelEnd(String columnLabelEnd) { |
|
90 |
setFloweringEndColumnLabel(columnLabelEnd); |
|
91 |
} |
|
92 |
|
|
93 |
public String getFloweringStartColumnLabel() { |
|
94 |
return floweringStartColumnLabel; |
|
95 |
} |
|
96 |
public void setFloweringStartColumnLabel(String floweringStartColumnLabel) { |
|
97 |
this.floweringStartColumnLabel = floweringStartColumnLabel; |
|
98 |
} |
|
99 |
|
|
100 |
public String getFloweringEndColumnLabel() { |
|
101 |
return floweringEndColumnLabel; |
|
102 |
} |
|
103 |
public void setFloweringEndColumnLabel(String floweringEndColumnLabel) { |
|
104 |
this.floweringEndColumnLabel = floweringEndColumnLabel; |
|
105 |
} |
|
106 |
|
|
107 |
public String getFruitingStartColumnLabel() { |
|
108 |
return fruitingStartColumnLabel; |
|
109 |
} |
|
110 |
public void setFruitingStartColumnLabel(String fruitingStartColumnLabel) { |
|
111 |
this.fruitingStartColumnLabel = fruitingStartColumnLabel; |
|
112 |
} |
|
113 |
|
|
114 |
public String getFruitingEndColumnLabel() { |
|
115 |
return fruitingEndColumnLabel; |
|
116 |
} |
|
117 |
public void setFruitingEndColumnLabel(String fruitingEndColumnLabel) { |
|
118 |
this.fruitingEndColumnLabel = fruitingEndColumnLabel; |
|
119 |
} |
|
120 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/PhenologyExcelImportState.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.fact.temporal.in; |
|
10 |
|
|
11 |
/** |
|
12 |
* State for taxon based phenology import. |
|
13 |
* |
|
14 |
* @author a.mueller |
|
15 |
* @since 15.07.2020 |
|
16 |
*/ |
|
17 |
public class PhenologyExcelImportState |
|
18 |
extends TemporalDataExcelImportState<PhenologyExcelImportConfigurator>{ |
|
19 |
|
|
20 |
public PhenologyExcelImportState(PhenologyExcelImportConfigurator config) { |
|
21 |
super(config); |
|
22 |
} |
|
23 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelFormatAnalyzer.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2020 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.fact.temporal.in; |
|
10 |
|
|
11 |
import eu.etaxonomy.cdm.io.fact.altitude.in.analyze.ExcelFormatAnalyzer; |
|
12 |
|
|
13 |
/** |
|
14 |
* Analyzer for taxon based temporal data import. |
|
15 |
* |
|
16 |
* TODO not yet implemented |
|
17 |
* |
|
18 |
* @author a.mueller |
|
19 |
* @since 15.07.2020 |
|
20 |
*/ |
|
21 |
public class TemporalDataExcelFormatAnalyzer<CONFIG extends TemporalDataExcelImportConfigurator<?>> |
|
22 |
extends ExcelFormatAnalyzer<CONFIG> { |
|
23 |
|
|
24 |
public TemporalDataExcelFormatAnalyzer(CONFIG config, |
|
25 |
String[] requiredWorksheets, |
|
26 |
String[] requiredColumns, |
|
27 |
String[] optionalColumns, |
|
28 |
String[] optionalMultiColumns) { |
|
29 |
super(config, requiredWorksheets, requiredColumns, optionalColumns, optionalMultiColumns); |
|
30 |
} |
|
31 |
|
|
32 |
protected TemporalDataExcelFormatAnalyzer(CONFIG config) { |
|
33 |
super(config, requiredWorksheets(), requiredColumns(), optionalColumns(), optionalMultiColumns()); |
|
34 |
} |
|
35 |
|
|
36 |
private static String[] requiredWorksheets() { |
|
37 |
return new String[]{"Data","Vocabulary"}; |
|
38 |
} |
|
39 |
|
|
40 |
private static String[] requiredColumns() { |
|
41 |
return new String[]{"taxonUuid", "xxx", "xxx"}; |
|
42 |
} |
|
43 |
|
|
44 |
private static String[] optionalColumns() { |
|
45 |
return new String[]{"nameCache", "nameFullCache"}; |
|
46 |
} |
|
47 |
private static String[] optionalMultiColumns() { |
|
48 |
return new String[]{}; |
|
49 |
} |
|
50 |
|
|
51 |
|
|
52 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImport.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.fact.temporal.in; |
|
10 |
|
|
11 |
import java.util.Map; |
|
12 |
import java.util.UUID; |
|
13 |
import java.util.regex.Matcher; |
|
14 |
import java.util.regex.Pattern; |
|
15 |
|
|
16 |
import org.apache.commons.lang3.StringUtils; |
|
17 |
import org.springframework.stereotype.Component; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase; |
|
20 |
import eu.etaxonomy.cdm.io.fact.in.FactExcelImportBase; |
|
21 |
import eu.etaxonomy.cdm.model.common.ExtendedTimePeriod; |
|
22 |
import eu.etaxonomy.cdm.model.description.Feature; |
|
23 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
24 |
import eu.etaxonomy.cdm.model.description.TemporalData; |
|
25 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
26 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
27 |
|
|
28 |
/** |
|
29 |
* Import for taxon based temporal data. |
|
30 |
* |
|
31 |
* @author a.mueller |
|
32 |
* @since 15.07.2020 |
|
33 |
*/ |
|
34 |
@Component |
|
35 |
public class TemporalDataExcelImport<STATE extends TemporalDataExcelImportState<CONFIG>, CONFIG extends TemporalDataExcelImportConfigurator<?>> |
|
36 |
extends FactExcelImportBase<STATE, CONFIG, ExcelRowBase>{ |
|
37 |
|
|
38 |
private static final long serialVersionUID = -2885338554616141176L; |
|
39 |
|
|
40 |
@Override |
|
41 |
protected String getWorksheetName(CONFIG config) { |
|
42 |
return "Data"; |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doFirstPass(STATE state, Taxon taxon, |
|
47 |
String line, String linePure){ |
|
48 |
|
|
49 |
if (taxon == null){ |
|
50 |
// return; |
|
51 |
taxon = Taxon.NewInstance(null, null); |
|
52 |
} |
|
53 |
|
|
54 |
Map<String, String> record = state.getOriginalRecord(); |
|
55 |
|
|
56 |
Feature feature = null; |
|
57 |
UUID uuidFeature = state.getConfig().getFeatureUuid(); |
|
58 |
if (uuidFeature != null){ |
|
59 |
feature = (Feature)getTermService().find(uuidFeature); |
|
60 |
} |
|
61 |
if (feature == null){ |
|
62 |
String message = "Feature could not be defined. Import not possible."; |
|
63 |
state.addError(message); |
|
64 |
return; |
|
65 |
} |
|
66 |
|
|
67 |
String colLabelStart = state.getConfig().getColumnLabelStart(); |
|
68 |
String colLabelEnd = state.getConfig().getColumnLabelEnd(); |
|
69 |
|
|
70 |
handleFeature(state, taxon, line, linePure, record, feature, colLabelStart, colLabelEnd); |
|
71 |
|
|
72 |
} |
|
73 |
|
|
74 |
protected void handleFeature(STATE state, Taxon taxon, String line, String linePure, |
|
75 |
Map<String, String> record, Feature feature, String startColLabel, String endColLabel) { |
|
76 |
|
|
77 |
TemporalData temporalData = TemporalData.NewInstance(feature); |
|
78 |
String startMonthStr = getValue(record, startColLabel); |
|
79 |
String endMonthStr = getValue(record, endColLabel); |
|
80 |
Integer startMonth = monthToInteger(state, startMonthStr, startColLabel, false); |
|
81 |
Integer startMonthExtreme = monthToInteger(state, startMonthStr, startColLabel, true); |
|
82 |
Integer endMonth = monthToInteger(state, endMonthStr, endColLabel, false); |
|
83 |
Integer endMonthExtreme = monthToInteger(state, endMonthStr, endColLabel, true); |
|
84 |
ExtendedTimePeriod period = ExtendedTimePeriod.NewExtendedMonthInstance(startMonth, endMonth, startMonthExtreme, endMonthExtreme); |
|
85 |
temporalData.setPeriod(period); |
|
86 |
|
|
87 |
//source |
|
88 |
String id = null; |
|
89 |
String idNamespace = getWorksheetName(state.getConfig()); |
|
90 |
Reference reference = getSourceReference(state); |
|
91 |
|
|
92 |
//description |
|
93 |
if (!temporalData.getPeriod().isEmpty()){ |
|
94 |
TaxonDescription taxonDescription = this.getTaxonDescription(taxon, reference, !IMAGE_GALLERY, true); |
|
95 |
taxonDescription.addElement(temporalData); |
|
96 |
temporalData.addImportSource(id, idNamespace, reference, linePure); |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
private Integer monthToInteger(STATE state, String monthStr, String colLabel, boolean isExtreme) { |
|
101 |
if(StringUtils.isBlank(monthStr)){ |
|
102 |
return null; |
|
103 |
}else { |
|
104 |
Matcher matcher = getPattern().matcher(monthStr); |
|
105 |
if (matcher.matches()){ |
|
106 |
if(isExtreme){ |
|
107 |
if (matcher.group(2) != null){ |
|
108 |
String extreme = matcher.group(2); |
|
109 |
return Integer.valueOf(extreme); |
|
110 |
}else{ |
|
111 |
return null; //extreme value does not exist |
|
112 |
} |
|
113 |
}else{ |
|
114 |
String normal = matcher.group(1); |
|
115 |
return Integer.valueOf(normal); |
|
116 |
} |
|
117 |
}else{ |
|
118 |
if (!isExtreme){ //we have to record this only once |
|
119 |
String message = "Value " + monthStr + " for " + colLabel + " could not be transformed to a valid month number. Value not imported." ; |
|
120 |
state.addError(message); |
|
121 |
} |
|
122 |
} |
|
123 |
} |
|
124 |
return null; |
|
125 |
} |
|
126 |
|
|
127 |
private Pattern monthPattern; |
|
128 |
private Pattern getPattern() { |
|
129 |
if (monthPattern == null){ |
|
130 |
String nr = "(0?[1-9]|1[0-2])"; |
|
131 |
monthPattern = Pattern.compile(nr + "\\s*(?:\\(" + nr + "\\))?"); |
|
132 |
} |
|
133 |
return monthPattern; |
|
134 |
} |
|
135 |
|
|
136 |
@Override |
|
137 |
protected boolean requiresNomenclaturalCode() { |
|
138 |
return false; |
|
139 |
} |
|
140 |
|
|
141 |
@Override |
|
142 |
protected boolean isIgnore(STATE state) { |
|
143 |
return false; |
|
144 |
} |
|
145 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportConfigurator.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.fact.temporal.in; |
|
10 |
|
|
11 |
import java.net.URI; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
|
14 |
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer; |
|
15 |
import eu.etaxonomy.cdm.io.fact.in.FactExcelImportConfiguratorBase; |
|
16 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
17 |
|
|
18 |
/** |
|
19 |
* Configurator for taxon based temporal data import. |
|
20 |
* |
|
21 |
* @author a.mueller |
|
22 |
* @since 15.07.2020 |
|
23 |
*/ |
|
24 |
public class TemporalDataExcelImportConfigurator<ANALYZE extends TemporalDataExcelFormatAnalyzer<?>> |
|
25 |
extends FactExcelImportConfiguratorBase<ANALYZE>{ |
|
26 |
|
|
27 |
private static final long serialVersionUID = 2413575026028295925L; |
|
28 |
|
|
29 |
private String columnLabelStart = "Start"; |
|
30 |
private String columnLabelEnd = "End"; |
|
31 |
|
|
32 |
public static final TemporalDataExcelImportConfigurator<TemporalDataExcelFormatAnalyzer<?>> NewTemporalInstance(URI uri, ICdmDataSource destination){ |
|
33 |
return new TemporalDataExcelImportConfigurator<TemporalDataExcelFormatAnalyzer<?>>(uri, destination, null); |
|
34 |
} |
|
35 |
|
|
36 |
protected TemporalDataExcelImportConfigurator(URI uri, ICdmDataSource destination, IInputTransformer transformer) { |
|
37 |
super(uri, destination, transformer); |
|
38 |
} |
|
39 |
|
|
40 |
@SuppressWarnings({ "unchecked" }) |
|
41 |
@Override |
|
42 |
public TemporalDataExcelImportState<?> getNewState() { |
|
43 |
return new TemporalDataExcelImportState<>(this); |
|
44 |
} |
|
45 |
|
|
46 |
@SuppressWarnings("unchecked") |
|
47 |
@Override |
|
48 |
protected void makeIoClassList() { |
|
49 |
ioClassList = new Class[]{ |
|
50 |
TemporalDataExcelImport.class, |
|
51 |
}; |
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* Note: This method needs to be overriden by potential subclasses. |
|
56 |
*/ |
|
57 |
@SuppressWarnings("unchecked") |
|
58 |
@Override |
|
59 |
public ANALYZE getAnalyzer() { |
|
60 |
return (ANALYZE)new TemporalDataExcelFormatAnalyzer(this); |
|
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public NomenclaturalCode getNomenclaturalCode() { |
|
65 |
NomenclaturalCode result = super.getNomenclaturalCode(); |
|
66 |
if (result == null){ |
|
67 |
result = NomenclaturalCode.ICNAFP; |
|
68 |
} |
|
69 |
return result; |
|
70 |
} |
|
71 |
|
|
72 |
public void setRowToNeglect(int row){ |
|
73 |
|
|
74 |
} |
|
75 |
|
|
76 |
public String getColumnLabelStart() { |
|
77 |
return columnLabelStart; |
|
78 |
} |
|
79 |
public void setColumnLabelStart(String columnLabelStart) { |
|
80 |
this.columnLabelStart = columnLabelStart; |
|
81 |
} |
|
82 |
|
|
83 |
public String getColumnLabelEnd() { |
|
84 |
return columnLabelEnd; |
|
85 |
} |
|
86 |
public void setColumnLabelEnd(String columnLabelEnd) { |
|
87 |
this.columnLabelEnd = columnLabelEnd; |
|
88 |
} |
|
89 |
|
|
90 |
} |
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/fact/temporal/in/TemporalDataExcelImportState.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2017 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.fact.temporal.in; |
|
10 |
|
|
11 |
import eu.etaxonomy.cdm.io.fact.in.FactExcelImportStateBase; |
|
12 |
|
|
13 |
/** |
|
14 |
* State for taxon based temporal data import. |
|
15 |
* |
|
16 |
* @author a.mueller |
|
17 |
* @since 15.07.2020 |
|
18 |
*/ |
|
19 |
public class TemporalDataExcelImportState<CONFIG extends TemporalDataExcelImportConfigurator> |
|
20 |
extends FactExcelImportStateBase<CONFIG>{ |
|
21 |
|
|
22 |
public TemporalDataExcelImportState(CONFIG config) { |
|
23 |
super(config); |
|
24 |
} |
|
25 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/Feature.java | ||
---|---|---|
204 | 204 |
private static final UUID uuidUseRecord = UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"); |
205 | 205 |
private static final UUID uuidNotes = UUID.fromString("b5780b45-6439-4f3c-9818-d89d26d36eb2"); |
206 | 206 |
public static final UUID uuidLifeform = UUID.fromString("db9228d3-8bbf-4460-abfe-0b1326c82f8e"); |
207 |
private static final UUID uuidFloweringPeriod = UUID.fromString("03710cb5-606e-444a-a3e6-594268e3cc47");
|
|
208 |
private static final UUID uuidFruitingPeriod = UUID.fromString("04aa8993-24b4-43e3-888c-5afaa733376e");
|
|
207 |
public static final UUID uuidFloweringPeriod = UUID.fromString("03710cb5-606e-444a-a3e6-594268e3cc47");
|
|
208 |
public static final UUID uuidFruitingPeriod = UUID.fromString("04aa8993-24b4-43e3-888c-5afaa733376e");
|
|
209 | 209 |
public static final UUID uuidAltitude = UUID.fromString("1a28ed59-e15f-4001-b5c2-ea89f0012671"); |
210 | 210 |
|
211 | 211 |
/* ***************** CONSTRUCTOR AND FACTORY METHODS **********************************/ |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TemporalData.java | ||
---|---|---|
47 | 47 |
@XmlElement(name = "Period") |
48 | 48 |
private ExtendedTimePeriod period = ExtendedTimePeriod.NewExtendedInstance(); |
49 | 49 |
|
50 |
|
|
51 | 50 |
/** |
52 |
* Creates a period fact with the given period.
|
|
51 |
* Creates a temporal fact with the given period.
|
|
53 | 52 |
*/ |
54 | 53 |
public static TemporalData NewInstance(ExtendedTimePeriod period){ |
55 | 54 |
TemporalData result = new TemporalData(); |
... | ... | |
57 | 56 |
return result; |
58 | 57 |
} |
59 | 58 |
|
59 |
public static TemporalData NewInstance(Feature feature){ |
|
60 |
TemporalData result = new TemporalData(); |
|
61 |
result.setFeature(feature); |
|
62 |
return result; |
|
63 |
} |
|
64 |
|
|
65 |
public static TemporalData NewInstance(Feature feature, ExtendedTimePeriod period){ |
|
66 |
TemporalData result = new TemporalData(); |
|
67 |
result.setFeature(feature); |
|
68 |
result.setPeriod(period); |
|
69 |
return result; |
|
70 |
} |
|
71 |
|
|
60 | 72 |
// *************************** CONSTRUCTOR *************************************/ |
61 | 73 |
|
62 | 74 |
/** |
Also available in: Unified diff
fix #9126 implement phenology import