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.cdmLight;
|
10
|
|
11
|
/**
|
12
|
* An enumeration with each instance representing a table type in the Output Model.
|
13
|
*
|
14
|
* @author a.mueller
|
15
|
* @since 15.03.2017
|
16
|
*/
|
17
|
public enum CdmLightExportTable {
|
18
|
METADATA("Metadata", metaDataColumns()),
|
19
|
SCIENTIFIC_NAME("ScientificName", nameColumns()),
|
20
|
NAME_RELATIONSHIP("NameRelationship",nameRelationColumns()),
|
21
|
HOMOTYPIC_GROUP("HomotypicGroup",homotypicGroupColumns()),
|
22
|
NOMENCLATURAL_AUTHOR("NomenclaturalAuthor", nomenclaturalAuthorColumns()),
|
23
|
NOMENCLATURAL_AUTHOR_TEAM_RELATION("NomenclaturalAuthorTeamRelation", nomenclaturalAuthorTeamRelColumns()),
|
24
|
TYPE_DESIGNATION("TypeDesignation", typeDesignationColumns()),
|
25
|
SPECIMEN("Specimen", specimenColumns()),
|
26
|
TAXON("Taxon", taxonColumns()),
|
27
|
SYNONYM("Synonym", synonymColumns()),
|
28
|
REFERENCE("Reference", referenceColumns()),
|
29
|
SIMPLE_FACT("SimpleFact", simpleFactsColumns()),
|
30
|
SPECIMEN_FACT("SpecimenFact", specimenFactsColumns()),
|
31
|
GEOGRAPHIC_AREA_FACT("GeographicAreaFact", geographicAreaFactsColumns()),
|
32
|
COMMON_NAME_FACT("CommonNameFact", commonNameFactsColumns()),
|
33
|
FACT_SOURCES("FactSources", factSourcesColumns()),
|
34
|
IDENTIFIER("Identifier", identifierColumns()),
|
35
|
MEDIA("Media", mediaColumns())
|
36
|
;
|
37
|
|
38
|
//Taxon/Synonym
|
39
|
protected static final String NAME_FK = "Name_FK";
|
40
|
protected static final String TAXON_ID = "Taxon_ID";
|
41
|
protected static final String TAXON_FK = "Taxon_FK";
|
42
|
protected static final String CLASSIFICATION_ID = "Classification_ID";
|
43
|
protected static final String CLASSIFICATION_TITLE = "Classification_Name";
|
44
|
protected static final String SYNONYM_ID = "Synonym_ID";
|
45
|
protected static final String PARENT_FK = "Parent_FK";
|
46
|
protected static final String SEC_REFERENCE_FK = "SecReference_FK";
|
47
|
protected static final String SEC_REFERENCE = "SecReference";
|
48
|
protected static final String SYN_SEC_REFERENCE_FK = "SynSecReference_FK";
|
49
|
protected static final String SYN_SEC_REFERENCE = "SynSecReference";
|
50
|
|
51
|
protected static final String IS_PRO_PARTE = "IsProParteSynonym";
|
52
|
protected static final String IS_PARTIAL = "IsPartial";
|
53
|
protected static final String IS_MISAPPLIED = "IsMisapplied";
|
54
|
//Reference
|
55
|
protected static final String REFERENCE_ID = "Reference_ID";
|
56
|
protected static final String BIBLIO_SHORT_CITATION = "BibliographicShortCitation";
|
57
|
protected static final String REF_TITLE = "Title";
|
58
|
protected static final String ABBREV_REF_TITLE = "Abbrev. Title";
|
59
|
protected static final String DATE_PUBLISHED = "DatePublished";
|
60
|
protected static final String EDITION = "Edition";
|
61
|
protected static final String EDITOR= "Editor";
|
62
|
protected static final String ISBN = "ISBN";
|
63
|
protected static final String ISSN = "ISSN";
|
64
|
protected static final String ORGANISATION = "Organisation";
|
65
|
protected static final String PAGES = "Pages";
|
66
|
protected static final String PLACE_PUBLISHED = "Place Published";
|
67
|
protected static final String PUBLISHER = "Publisher";
|
68
|
protected static final String REF_ABSTRACT = "Reference Abstract";
|
69
|
protected static final String SERIES_PART = "Series Part";
|
70
|
protected static final String VOLUME = "Volume";
|
71
|
protected static final String YEAR = "Year";
|
72
|
protected static final String AUTHORSHIP_TITLE = "Authorship";
|
73
|
|
74
|
|
75
|
protected static final String IN_REFERENCE = "inReference";
|
76
|
protected static final String INSTITUTION = "Institution";
|
77
|
// protected static final String LSID = "LSID";
|
78
|
protected static final String SCHOOL = "School";
|
79
|
protected static final String REF_TYPE = "Reference Type";
|
80
|
protected static final String URI = "URI";
|
81
|
|
82
|
//Name
|
83
|
protected static final String NAME_ID = "Name_ID";
|
84
|
// protected static final String TROPICOS_ID = "Tropicos_ID";
|
85
|
// protected static final String IPNI_ID = "IPNI_ID";
|
86
|
// protected static final String WFO_ID = "WorldFloraOnline_ID";
|
87
|
protected static final String LSID = "LSID";
|
88
|
protected static final String RANK = "Rank";
|
89
|
protected static final String RANK_SEQUENCE = "Rank_Sequence";
|
90
|
protected static final String FULL_NAME_WITH_AUTHORS = "FullNameWithAuthors";
|
91
|
protected static final String FULL_NAME_NO_AUTHORS = "FullNameNoAuthors";
|
92
|
protected static final String GENUS_UNINOMIAL = "GenusOrUninomial";
|
93
|
protected static final String INFRAGENERIC_RANK = "InfragenericRank";
|
94
|
protected static final String INFRAGENERIC_EPITHET = "InfraGenericEpithet";
|
95
|
protected static final String SPECIFIC_EPITHET = "SpecificEpithet";
|
96
|
protected static final String INFRASPECIFIC_RANK = "InfraspecificRank";
|
97
|
protected static final String INFRASPECIFIC_EPITHET = "InfraSpecificEpithet ";
|
98
|
protected static final String BAS_EX_AUTHORTEAM_FK = "BasionymExAuthorTeam_Fk";
|
99
|
protected static final String BAS_AUTHORTEAM_FK = "BasionymAuthorTeam_Fk";
|
100
|
protected static final String COMB_EX_AUTHORTEAM_FK = "PublishingExAuthorTeam_Fk";
|
101
|
protected static final String COMB_AUTHORTEAM_FK = "PublishingAuthorTeam_Fk";
|
102
|
protected static final String AUTHOR_TEAM_STRING = "AuthorTeamString";
|
103
|
// protected static final String REFERENCE_FK = "Reference_Fk"
|
104
|
protected static final String PUBLICATION_TYPE = "PublicationType";
|
105
|
protected static final String ABBREV_TITLE = "AbbreviatedTitle";
|
106
|
protected static final String FULL_TITLE = "FullTitle";
|
107
|
protected static final String ABBREV_REF_AUTHOR = "AbbreviatedInRefAuthor";
|
108
|
protected static final String FULL_REF_AUTHOR = "FullInRefAuthor";
|
109
|
protected static final String COLLATION = "Collation";
|
110
|
protected static final String VOLUME_ISSUE = "Volume_Issue";
|
111
|
protected static final String DETAIL = "Detail";
|
112
|
protected static final String YEAR_PUBLISHED = "YearPublished";
|
113
|
protected static final String VERBATIM_DATE = "VerbatimDate";
|
114
|
protected static final String PROTOLOGUE_URI = "ProtologueURI";
|
115
|
protected static final String NOM_STATUS = "NomenclaturalStatus";
|
116
|
protected static final String NOM_STATUS_ABBREV = "NomenclaturalStatusAbbreviation";
|
117
|
protected static final String HOMOTYPIC_GROUP_FK = "HomotypicGroup_Fk";
|
118
|
protected static final String HOMOTYPIC_GROUP_SEQ = "HomotypicGroupSequenceNumber";
|
119
|
|
120
|
|
121
|
//Name Relationship
|
122
|
protected static final String NAME1_FK = "Name1_FK";
|
123
|
protected static final String NAME2_FK = "Name2_FK";
|
124
|
protected static final String NAME_REL_TYPE = "NameRelationship_Type";
|
125
|
|
126
|
//CDM MetaData
|
127
|
protected static final String INSTANCE_ID = "EditInstance_ID";
|
128
|
protected static final String INSTANCE_NAME = "EditInstanceName";
|
129
|
|
130
|
//Homotypic Group
|
131
|
protected static final String HOMOTYPIC_GROUP_ID = "HomotypicGroup_ID";
|
132
|
protected static final String HOMOTYPIC_GROUP_STRING = "HomotypicGroupString";
|
133
|
protected static final String TYPE_STRING = "TypeString";
|
134
|
|
135
|
//NomenclaturalAuthor
|
136
|
protected static final String AUTHOR_ID = "Author_ID";
|
137
|
protected static final String ABBREV_AUTHOR = "AbbrevAuthor";
|
138
|
protected static final String AUTHOR_TITLE = "AuthorTitle";
|
139
|
protected static final String AUTHOR_GIVEN_NAME = "AuthorFirstName";
|
140
|
protected static final String AUTHOR_FAMILY_NAME = "AuthorLastName";
|
141
|
protected static final String AUTHOR_PREFIX = "AuthorPrefix";
|
142
|
protected static final String AUTHOR_SUFFIX = "AuthorSuffix";
|
143
|
|
144
|
//Nomenclatural Author AuthorTeam Relations
|
145
|
|
146
|
protected static final String AUTHOR_FK = "Author_Fk";
|
147
|
protected static final String AUTHOR_TEAM_FK = "AuthorTeam_Fk";
|
148
|
protected static final String AUTHOR_TEAM_SEQ_NUMBER = "SequenceNumber";
|
149
|
|
150
|
//TypeDesignations
|
151
|
|
152
|
protected static final String SPECIMEN_FK = "Specimen_Fk";
|
153
|
protected static final String TYPE_VERBATIM_CITATION = "TypeVerbatimCitation";
|
154
|
protected static final String TYPE_CATEGORY = "TypeCategory";
|
155
|
protected static final String TYPE_DESIGNATED_BY_STRING = "TypeDesignatedByString";
|
156
|
protected static final String TYPE_DESIGNATED_BY_REF_FK = "TypeDesignationByRef_Fk";
|
157
|
|
158
|
//Specimen
|
159
|
|
160
|
protected static final String SPECIMEN_ID = "Specimen_Id";
|
161
|
protected static final String SPECIMEN_CITATION = "SpecimenCitation";
|
162
|
protected static final String LOCALITY= "Locality";
|
163
|
protected static final String COUNTRY = "Country";
|
164
|
protected static final String AREA_CATEGORY1 = "AreaCategory1";
|
165
|
protected static final String AREA_NAME1 = "AreaName1";
|
166
|
protected static final String AREA_CATEGORY2 = "AreaCategory2";
|
167
|
protected static final String AREA_NAME2 = "AreaName2";
|
168
|
protected static final String AREA_CATEGORY3 = "AreaCategory3";
|
169
|
protected static final String AREA_NAME3 = "AreaName3";
|
170
|
protected static final String FURTHER_AREAS = "FurtherAreas";
|
171
|
protected static final String COLLECTOR_STRING = "CollectorString";
|
172
|
protected static final String COLLECTOR_NUMBER = "CollectorNumber";
|
173
|
protected static final String COLLECTION_DATE = "CollectionDate";
|
174
|
protected static final String SPECIMEN_IMAGE_URIS = "SpecimenImageURIs";
|
175
|
protected static final String HERBARIUM_ABBREV = "HerbariumAbbrev";
|
176
|
protected static final String MEDIA_SPECIMEN_URL = "MediaSpecimenURI";
|
177
|
//other specimen attributes
|
178
|
|
179
|
|
180
|
//SimpleFacts
|
181
|
protected static final String FACT_ID = "Fact_Id";
|
182
|
protected static final String FACT_TEXT = "FactText";
|
183
|
protected static final String LANGUAGE = "Language";
|
184
|
protected static final String MEDIA_URI = "MediaURI";
|
185
|
protected static final String FACT_CATEGORY = "FactCategory";
|
186
|
|
187
|
// Specimen Facts
|
188
|
protected static final String SPECIMEN_NOTES = "Specimen Notes";
|
189
|
protected static final String SPECIMEN_DESCRIPTION = "Specimen Description";
|
190
|
|
191
|
|
192
|
//Geographic Area Facts
|
193
|
protected static final String AREA_LABEL = "AreaLabel";
|
194
|
protected static final String STATUS_LABEL = "StatusLabel";
|
195
|
|
196
|
|
197
|
//FactSources
|
198
|
protected static final String FACT_FK = "Fact_Fk";
|
199
|
protected static final String REFERENCE_FK = "Reference_Fk";
|
200
|
protected static final String NAME_IN_SOURCE_FK = "NameInSource_Fk";
|
201
|
protected static final String FACT_TYPE = "FactType";
|
202
|
|
203
|
//Identifiers
|
204
|
protected static final String IDENTIFIER_IDS = "Identifier_IDs";
|
205
|
protected static final String IDENTIFIER_TYPE = "Identifier_Type";
|
206
|
|
207
|
final static String[] homotypicGroupColumns(){
|
208
|
return new String[]{HOMOTYPIC_GROUP_ID, HOMOTYPIC_GROUP_STRING, TYPE_STRING};
|
209
|
}
|
210
|
|
211
|
|
212
|
|
213
|
|
214
|
|
215
|
/**
|
216
|
* @return
|
217
|
*/
|
218
|
private static String[] identifierColumns() {
|
219
|
|
220
|
return new String[]{ NAME_FK, IDENTIFIER_IDS, IDENTIFIER_TYPE};
|
221
|
}
|
222
|
/**
|
223
|
* @return
|
224
|
*/
|
225
|
private static String[] mediaColumns() {
|
226
|
return new String[]{ FACT_ID, TAXON_FK, NAME_FK, MEDIA_URI};
|
227
|
}
|
228
|
|
229
|
|
230
|
final static String[] factSourcesColumns() {
|
231
|
return new String[]{FACT_FK, REFERENCE_FK, NAME_IN_SOURCE_FK, FACT_TYPE};
|
232
|
}
|
233
|
|
234
|
final static String[] specimenFactsColumns() {
|
235
|
return new String[]{FACT_ID, TAXON_FK, SPECIMEN_FK, SPECIMEN_DESCRIPTION, SPECIMEN_NOTES};
|
236
|
}
|
237
|
|
238
|
final static String[] commonNameFactsColumns() {
|
239
|
return new String[]{FACT_ID, TAXON_FK, FACT_TEXT, LANGUAGE, AREA_LABEL};
|
240
|
|
241
|
}
|
242
|
final static String[] geographicAreaFactsColumns() {
|
243
|
return new String[]{FACT_ID, TAXON_FK, AREA_LABEL, STATUS_LABEL};
|
244
|
|
245
|
}
|
246
|
final static String[] simpleFactsColumns() {
|
247
|
return new String[]{FACT_ID, TAXON_FK, NAME_FK, FACT_TEXT, LANGUAGE, MEDIA_URI, FACT_CATEGORY};
|
248
|
|
249
|
}
|
250
|
final static String[] nomenclaturalAuthorColumns() {
|
251
|
return new String[]{AUTHOR_ID, ABBREV_AUTHOR, AUTHOR_TITLE, AUTHOR_GIVEN_NAME, AUTHOR_FAMILY_NAME, AUTHOR_PREFIX, AUTHOR_SUFFIX};
|
252
|
}
|
253
|
|
254
|
final static String[] nomenclaturalAuthorTeamRelColumns() {
|
255
|
return new String[]{AUTHOR_TEAM_FK, AUTHOR_FK, AUTHOR_TEAM_SEQ_NUMBER};
|
256
|
}
|
257
|
|
258
|
final static String[] metaDataColumns(){
|
259
|
return new String[]{INSTANCE_ID, INSTANCE_NAME};
|
260
|
}
|
261
|
final static String[] nameRelationColumns(){
|
262
|
return new String[]{NAME1_FK, NAME2_FK, NAME_REL_TYPE};
|
263
|
}
|
264
|
final static String[] nameColumns(){
|
265
|
return new String[]{NAME_ID, LSID, RANK, RANK_SEQUENCE,
|
266
|
FULL_NAME_WITH_AUTHORS, FULL_NAME_NO_AUTHORS, GENUS_UNINOMIAL,
|
267
|
INFRAGENERIC_RANK, INFRAGENERIC_EPITHET, SPECIFIC_EPITHET,
|
268
|
INFRASPECIFIC_RANK, INFRASPECIFIC_EPITHET,
|
269
|
BAS_EX_AUTHORTEAM_FK, BAS_AUTHORTEAM_FK, COMB_EX_AUTHORTEAM_FK, COMB_AUTHORTEAM_FK,
|
270
|
AUTHOR_TEAM_STRING, REFERENCE_FK, PUBLICATION_TYPE, ABBREV_TITLE, FULL_TITLE,
|
271
|
ABBREV_REF_AUTHOR, FULL_REF_AUTHOR, COLLATION, VOLUME_ISSUE,
|
272
|
DETAIL, DATE_PUBLISHED, YEAR_PUBLISHED, VERBATIM_DATE, PROTOLOGUE_URI,
|
273
|
NOM_STATUS, NOM_STATUS_ABBREV, HOMOTYPIC_GROUP_FK,
|
274
|
HOMOTYPIC_GROUP_SEQ
|
275
|
};
|
276
|
}
|
277
|
final static String[] taxonColumns(){
|
278
|
return new String[]{TAXON_ID, CLASSIFICATION_ID, CLASSIFICATION_TITLE, NAME_FK, PARENT_FK, SEC_REFERENCE_FK, SEC_REFERENCE};
|
279
|
}
|
280
|
final static String[] synonymColumns(){
|
281
|
return new String[]{SYNONYM_ID, TAXON_FK, NAME_FK, SEC_REFERENCE_FK, SEC_REFERENCE, IS_PRO_PARTE};
|
282
|
}
|
283
|
final static String[] referenceColumns(){
|
284
|
return new String[]{REFERENCE_ID, BIBLIO_SHORT_CITATION, REF_TITLE,ABBREV_REF_TITLE, DATE_PUBLISHED, EDITION, EDITOR, ISBN,ISSN, ORGANISATION, PAGES, PLACE_PUBLISHED, PUBLISHER,
|
285
|
REF_ABSTRACT, SERIES_PART, VOLUME, YEAR, AUTHORSHIP_TITLE, AUTHOR_FK, IN_REFERENCE, INSTITUTION, LSID, SCHOOL, REF_TYPE, URI};
|
286
|
}
|
287
|
|
288
|
final static String[] typeDesignationColumns(){
|
289
|
return new String[]{SPECIMEN_FK, NAME_FK, TYPE_VERBATIM_CITATION, TYPE_CATEGORY, TYPE_DESIGNATED_BY_STRING, TYPE_DESIGNATED_BY_REF_FK};
|
290
|
}
|
291
|
|
292
|
final static String[] specimenColumns() {
|
293
|
return new String[]{SPECIMEN_ID, SPECIMEN_CITATION, LOCALITY, COUNTRY, AREA_CATEGORY1, AREA_NAME1, AREA_CATEGORY2, AREA_NAME2, AREA_CATEGORY3, AREA_NAME3,
|
294
|
FURTHER_AREAS, COLLECTOR_STRING, COLLECTOR_NUMBER, COLLECTION_DATE, SPECIMEN_IMAGE_URIS, HERBARIUM_ABBREV, MEDIA_SPECIMEN_URL};
|
295
|
}
|
296
|
|
297
|
|
298
|
|
299
|
private String tableName;
|
300
|
private String[] columnNames;
|
301
|
|
302
|
// ************** CONSTRUCTOR *******************/
|
303
|
|
304
|
private CdmLightExportTable(String tableName, String[] columnNames){
|
305
|
this.tableName = tableName;
|
306
|
this.columnNames = columnNames;
|
307
|
}
|
308
|
|
309
|
// ****************** GETTER / SETTER *************/
|
310
|
|
311
|
public String getTableName() {return tableName;}
|
312
|
|
313
|
public int getSize(){ return columnNames.length;}
|
314
|
|
315
|
public String[] getColumnNames(){return columnNames;}
|
316
|
|
317
|
/**
|
318
|
* @param taxonId
|
319
|
* @return
|
320
|
*/
|
321
|
public int getIndex(String columnName) {
|
322
|
int index= 0;
|
323
|
for(String column : getColumnNames()){
|
324
|
if (column.equals(columnName)){
|
325
|
return index;
|
326
|
}
|
327
|
index++;
|
328
|
}
|
329
|
return -1;
|
330
|
}
|
331
|
|
332
|
|
333
|
}
|