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.dwca.out;
|
10
|
|
11
|
import eu.etaxonomy.cdm.io.stream.terms.TermUri;
|
12
|
|
13
|
/**
|
14
|
* @author a.mueller
|
15
|
\* @since 25.06.2017
|
16
|
*
|
17
|
*/
|
18
|
public enum DwcaTaxExportFile {
|
19
|
METADATA(DwcaMetaDataExport.fileName, null),
|
20
|
EML(DwcaEmlExport.fileName, null),
|
21
|
TAXON(DwcaTaxonExport.fileName, taxonColumns()),
|
22
|
DISTRIBUTION(DwcaDistributionExport.fileName, distributionColumns()),
|
23
|
DESCRIPTION(DwcaDescriptionExport.fileName, null),
|
24
|
IMAGE(DwcaImageExport.fileName, null),
|
25
|
REFERENCE(DwcaReferenceExport.fileName, null),
|
26
|
RESOURCE_RELATION(DwcaResourceRelationExport.fileName, null),
|
27
|
TYPES(DwcaTypesExport.fileName, null),
|
28
|
VERNACULAR(DwcaVernacularExport.fileName, null),
|
29
|
REPORT("_exportReport.txt", null),
|
30
|
|
31
|
|
32
|
// SCIENTIFIC_NAME("ScientificName", nameColumns()),
|
33
|
// NAME_RELATIONSHIP("NameRelationship",nameRelationColumns()),
|
34
|
|
35
|
|
36
|
;
|
37
|
|
38
|
|
39
|
final static TermUri[] taxonColumns(){
|
40
|
return new TermUri[]{TermUri.DC_IDENTIFIER, TermUri.DWC_SCIENTIFIC_NAME_ID, TermUri.DWC_ACCEPTED_NAME_USAGE_ID,
|
41
|
TermUri.DWC_SCIENTIFIC_NAME, TermUri.DWC_TAXON_RANK, TermUri.DWC_TAXONOMIC_STATUS, TermUri.DWC_ORIGINAL_NAME_USAGE_ID,
|
42
|
TermUri.DWC_NAME_ACCORDING_TO_ID, TermUri.DWC_NAME_ACCORDING_TO_ID, TermUri.DWC_NAME_PUBLISHED_IN_ID,
|
43
|
TermUri.DWC_TAXON_CONCEPT_ID, TermUri.DWC_ACCEPTED_NAME_USAGE, TermUri.DWC_PARENT_NAME_USAGE,
|
44
|
TermUri.DWC_ORIGINAL_NAME_USAGE,
|
45
|
TermUri.DWC_NAME_ACCORDING_TO, TermUri.DWC_NAME_PUBLISHED_IN,
|
46
|
TermUri.DWC_HIGHER_CLASSIFICATION, TermUri.DWC_KINGDOM, TermUri.DWC_PHYLUM, TermUri.DWC_CLASS,
|
47
|
TermUri.DWC_ORDER, TermUri.DWC_FAMILY, TermUri.DWC_GENUS, TermUri.DWC_SUBGENUS,
|
48
|
TermUri.TDWG_UNINOMIAL, TermUri.TDWG_GENUSPART, TermUri.TDWG_INFRAGENERICEPITHET,
|
49
|
TermUri.DWC_SPECIFIC_EPI, TermUri.DWC_INFRA_SPECIFIC_EPI,
|
50
|
TermUri.DWC_VERBATIM_TAXON_RANK, TermUri.DWC_VERNACULAR_NAME, TermUri.DWC_NOMENCLATURAL_CODE,
|
51
|
TermUri.DWC_NOMENCLATURAL_STATUS, TermUri.DWC_TAXON_REMARKS, TermUri.DC_MODIFIED,
|
52
|
TermUri.DC_LANGUAGE, TermUri.DC_RIGHTS, TermUri.DC_RIGHTS_HOLDER, TermUri.DC_ACCESS_RIGHTS,
|
53
|
TermUri.DC_BIBLIOGRAPHIC_CITATION, TermUri.DWC_INFORMATION_WITHHELD, TermUri.DWC_DATASET_NAME,
|
54
|
TermUri.DC_SOURCE};
|
55
|
}
|
56
|
|
57
|
|
58
|
/**
|
59
|
* @return
|
60
|
*/
|
61
|
final static TermUri[] distributionColumns() {
|
62
|
return new TermUri[]{
|
63
|
TermUri.DC_IDENTIFIER, //Fixme this should be the FK to taxon
|
64
|
TermUri.DWC_LOCATION_ID, TermUri.DWC_LOCALITY,
|
65
|
TermUri.DWC_COUNTRY_CODE, TermUri.DWC_LIFESTAGE,
|
66
|
TermUri.IUCN_THREAD_STATUS, TermUri.DWC_OCCURRENCE_STATUS,
|
67
|
TermUri.DWC_ESTABLISHMENT_MEANS, TermUri.GBIF_APPENDIX_CITES,
|
68
|
TermUri.DWC_EVENT_DATE,
|
69
|
TermUri.DWC_START_DAY_OF_YEAR, TermUri.DWC_END_DAY_OF_YEAR,
|
70
|
TermUri.DC_SOURCE, TermUri.DWC_OCCURRENCE_REMARKS,
|
71
|
};
|
72
|
}
|
73
|
|
74
|
|
75
|
private String tableName;
|
76
|
private TermUri[] columnNames;
|
77
|
|
78
|
// ************** CONSTRUCTOR *******************/
|
79
|
|
80
|
private DwcaTaxExportFile(String tableName, TermUri[] columnNames){
|
81
|
this.tableName = tableName;
|
82
|
this.columnNames = columnNames;
|
83
|
}
|
84
|
|
85
|
// ****************** GETTER / SETTER *************/
|
86
|
|
87
|
public String getTableName() {return tableName;}
|
88
|
|
89
|
public int getSize(){ return columnNames.length;}
|
90
|
|
91
|
public TermUri[] getColumnNames(){return columnNames;}
|
92
|
|
93
|
public String[] getColumnNamesString(){
|
94
|
String[] result = new String[columnNames.length];
|
95
|
for (int i= 0; i < columnNames.length; i++){
|
96
|
result[i] = columnNames[i].toString();
|
97
|
}
|
98
|
|
99
|
return result;
|
100
|
}
|
101
|
|
102
|
|
103
|
/**
|
104
|
* @param taxonId
|
105
|
* @return
|
106
|
*/
|
107
|
public int getIndex(TermUri columnName) {
|
108
|
int index= 0;
|
109
|
for(TermUri column : getColumnNames()){
|
110
|
if (column.equals(columnName)){
|
111
|
return index;
|
112
|
}
|
113
|
index++;
|
114
|
}
|
115
|
return -1;
|
116
|
}
|
117
|
}
|