Project

General

Profile

Download (18.3 KB) Statistics
| Branch: | Tag: | Revision:
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("PersonOrTeam", nomenclaturalAuthorColumns()),
23
    NOMENCLATURAL_AUTHOR_TEAM_RELATION("PersonTeamRelation", 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
    TAXON_INTERACTION_FACT("TaxonInteractionFact", taxonInteractionFactsColumns()),
31
    SPECIMEN_FACT("SpecimenFact", specimenFactsColumns()),
32
    GEOGRAPHIC_AREA_FACT("GeographicAreaFact", geographicAreaFactsColumns()),
33
    COMMON_NAME_FACT("CommonNameFact", commonNameFactsColumns()),
34
    FACT_SOURCES("FactSources", factSourcesColumns()),
35
    IDENTIFIER("Identifier", identifierColumns()),
36
    MEDIA("MediaFact", mediaColumns()),
37
    CONDENSED_DISTRIBUTION_FACT("CondensedDistributionFact", compressedDistributionFactColumns()),
38
    NAME_FACT("NameFact", nameFactColumns())
39

    
40
    ;
41

    
42
    //Taxon/Synonym
43
    protected static final String NAME_FK = "Name_Fk";
44
    protected static final String TAXON_ID = "Taxon_ID";
45
    protected static final String TAXON_FK = "Taxon_Fk";
46
    protected static final String CLASSIFICATION_ID = "Classification_ID";
47
    protected static final String CLASSIFICATION_TITLE = "ClassificationName";
48
    protected static final String SYNONYM_ID = "Synonym_ID";
49
    protected static final String PARENT_FK = "Parent_Fk";
50
    protected static final String SEC_REFERENCE_FK = "SecReference_Fk";
51
    protected static final String SEC_REFERENCE = "SecReference";
52
    protected static final String SORT_INDEX = "SortIndex";
53
    protected static final String UNPLACED = "Unplaced";
54
    protected static final String EXCLUDED = "Excluded";
55
    protected static final String DOUBTFUL = "PlacementDoubtful";
56
    protected static final String PUBLISHED = "Published";
57
    protected static final String STATUS_NOTES = "StatusNotes";
58

    
59
    //pro parte / misapplied
60
    protected static final String SYN_SEC_REFERENCE_FK = "SynSecReference_Fk";
61
    protected static final String SYN_SEC_REFERENCE = "SynSecReference";
62
    protected static final String IS_PRO_PARTE = "IsProParteSynonym";
63
    protected static final String IS_PARTIAL = "IsPartial";
64
    protected static final String IS_MISAPPLIED = "IsMisapplied";
65

    
66
    //Reference
67
    protected static final String REFERENCE_ID = "Reference_ID";
68
    protected static final String BIBLIO_SHORT_CITATION = "BibliographicShortCitation";
69
    protected static final String REF_TITLE = "Title";
70
    protected static final String ABBREV_REF_TITLE = "AbbrevTitle";
71
    protected static final String DATE_PUBLISHED = "DatePublished";
72
    protected static final String EDITION = "Edition";
73
    protected static final String EDITOR= "Editor";
74
    protected static final String ISBN = "ISBN";
75
    protected static final String ISSN = "ISSN";
76
    protected static final String ORGANISATION = "Organisation";
77
    protected static final String PAGES = "Pages";
78
    protected static final String PLACE_PUBLISHED = "PlacePublished";
79
    protected static final String PUBLISHER = "Publisher";
80
    protected static final String REF_ABSTRACT = "ReferenceAbstract";
81
    protected static final String SERIES_PART = "SeriesPart";
82
    protected static final String VOLUME = "Volume";
83
    protected static final String YEAR = "Year";
84
    protected static final String AUTHORSHIP_TITLE = "FullAuthor";
85

    
86

    
87
    protected static final String IN_REFERENCE = "InReference";
88
    protected static final String INSTITUTION = "Institution";
89
   // protected static final String LSID = "LSID";
90
    protected static final String SCHOOL = "School";
91
    protected static final String REF_TYPE = "ReferenceType";
92
    protected static final String URI = "URI";
93

    
94
    //Name
95
    protected static final String NAME_ID = "Name_ID";
96
//    protected static final String TROPICOS_ID = "Tropicos_ID";
97
//    protected static final String IPNI_ID = "IPNI_ID";
98
//    protected static final String WFO_ID = "WorldFloraOnline_ID";
99
    protected static final String LSID = "LSID";
100
    protected static final String RANK = "Rank";
101
    protected static final String RANK_SEQUENCE = "RankSequence";
102
    protected static final String FULL_NAME_WITH_AUTHORS = "FullNameWithAuthors";
103
    protected static final String FULL_NAME_NO_AUTHORS = "FullNameNoAuthors";
104
    protected static final String GENUS_UNINOMIAL = "GenusOrUninomial";
105
    protected static final String INFRAGENERIC_RANK = "InfragenericRank";
106
    protected static final String INFRAGENERIC_EPITHET = "InfraGenericEpithet";
107
    protected static final String SPECIFIC_EPITHET = "SpecificEpithet";
108
    protected static final String INFRASPECIFIC_RANK = "InfraspecificRank";
109
    protected static final String INFRASPECIFIC_EPITHET = "InfraSpecificEpithet ";
110
    protected static final String BAS_EX_AUTHORTEAM_FK = "BasionymExAuthorTeam_Fk";
111
    protected static final String BAS_AUTHORTEAM_FK = "BasionymAuthorTeam_Fk";
112
    protected static final String COMB_EX_AUTHORTEAM_FK = "PublishingExAuthorTeam_Fk";
113
    protected static final String COMB_AUTHORTEAM_FK = "PublishingAuthorTeam_Fk";
114
    protected static final String AUTHOR_TEAM_STRING = "AuthorTeamString";
115
   // protected static final String REFERENCE_FK = "Reference_Fk"
116
    protected static final String PUBLICATION_TYPE = "PublicationType";
117
    protected static final String ABBREV_TITLE = "AbbreviatedTitle";
118
    protected static final String FULL_TITLE = "FullTitle";
119
    protected static final String ABBREV_REF_AUTHOR = "AbbreviatedInRefAuthor";
120
    protected static final String FULL_REF_AUTHOR = "FullInRefAuthor";
121
    protected static final String COLLATION = "Collation";
122
    protected static final String VOLUME_ISSUE = "VolumeIssue";
123
    protected static final String DETAIL = "Detail";
124
    protected static final String YEAR_PUBLISHED = "YearPublished";
125
    protected static final String VERBATIM_DATE = "VerbatimDate";
126
    protected static final String PROTOLOGUE_URI = "ProtologueURI";
127
    protected static final String NOM_STATUS = "NomenclaturalStatus";
128
    protected static final String NOM_STATUS_ABBREV = "NomenclaturalStatusAbbreviation";
129
    protected static final String HOMOTYPIC_GROUP_FK = "HomotypicGroup_Fk";
130
    protected static final String HOMOTYPIC_GROUP_SEQ = "HomotypicGroupSequenceNumber";
131
    protected static final String PROTOLOGUE_TYPE_STATEMENT = "ProtologueTypeStatement";
132
    protected static final String TYPE_SPECIMEN = "TypeSpecimens";
133
    protected static final String TYPE_STATEMENT = "TypeStatements";
134

    
135

    
136

    
137
    //Name Relationship
138
    protected static final String NAME1_FK = "Name1_Fk";
139
    protected static final String NAME2_FK = "Name2_Fk";
140
    protected static final String NAME_REL_TYPE = "NameRelationshipType";
141

    
142
    //CDM MetaData
143
    protected static final String INSTANCE_ID = "EditInstance_ID";
144
    protected static final String INSTANCE_NAME = "EditInstanceName";
145

    
146
    protected static final String DATASET_DESCRIPTION = "DatasetDescription";
147
    protected static final String DATASET_CREATOR = "DatasetCreator";
148
    protected static final String DATASET_CONTRIBUTOR = "DatasetContributor";
149
    protected static final String DATASET_TITLE = "DatasetTitle";
150
    protected static final String DATASET_LANGUAGE = "Language";
151
    protected static final String DATASET_LANDINGPAGE = "DataSetLandingPage";
152
    protected static final String DATASET_DOWNLOAD_LINK = "DatasetDownloadLink";
153
    protected static final String DATASET_BASE_URL = "DatasetBaseUrl";
154
    protected static final String DATASET_RECOMMENDED_CITATTION = "RecommendedCitation";
155
    protected static final String DATASET_LOCATION = "DatasetLocation";
156
    protected static final String DATASET_KEYWORDS = "DatasetKeywords";
157
    protected static final String DATASET_LICENCE = "Licence";
158

    
159

    
160
    //Homotypic Group
161
    protected static final String HOMOTYPIC_GROUP_ID = "HomotypicGroup_ID";
162
    protected static final String HOMOTYPIC_GROUP_STRING = "HomotypicGroupString";
163
    protected static final String TYPE_STRING = "TypeSpecimenString";
164
    protected static final String TYPE_CACHE = "TypeStatementsString";
165

    
166
    //NomenclaturalAuthor
167
    protected static final String AUTHOR_ID = "PersonOrTeam_ID";
168
    protected static final String ABBREV_AUTHOR = "AbbrevNames";
169
    protected static final String AUTHOR_TITLE = "FullNames";
170
    protected static final String AUTHOR_GIVEN_NAME = "PersonOtherNames";
171
    protected static final String AUTHOR_FAMILY_NAME = "PersonFamiliyNames";
172
    protected static final String AUTHOR_PREFIX = "PersonPrefix";
173
    protected static final String AUTHOR_SUFFIX = "PersonSuffix";
174

    
175
  //Nomenclatural Author AuthorTeam Relations
176

    
177
    protected static final String AUTHOR_FK = "Author_Fk";
178
    protected static final String AUTHOR_TEAM_FK = "AuthorTeam_Fk";
179
    protected static final String AUTHOR_TEAM_SEQ_NUMBER = "SequenceNumber";
180

    
181
    //TypeDesignations
182

    
183
    protected static final String SPECIMEN_FK = "Specimen_Fk";
184
    protected static final String TYPE_VERBATIM_CITATION = "TypeVerbatimCitation";
185
    protected static final String TYPE_CATEGORY = "TypeCategory";
186
    protected static final String TYPE_DESIGNATED_BY_STRING = "TypeDesignatedByString";
187
    protected static final String TYPE_DESIGNATED_BY_REF_FK = "TypeDesignationByRef_Fk";
188

    
189
    //Specimen
190

    
191
    protected static final String SPECIMEN_ID = "Specimen_ID";
192
    protected static final String SPECIMEN_CITATION = "SpecimenCitation";
193
    protected static final String FIELDUNIT_CITATION = "FieldUnitCitation";
194
    protected static final String LOCALITY= "Locality";
195
    protected static final String COUNTRY = "Country";
196
    protected static final String AREA_CATEGORY1 = "AreaCategory1";
197
    protected static final String AREA_NAME1 = "AreaName1";
198
    protected static final String AREA_CATEGORY2 = "AreaCategory2";
199
    protected static final String AREA_NAME2 = "AreaName2";
200
    protected static final String AREA_CATEGORY3 = "AreaCategory3";
201
    protected static final String AREA_NAME3 = "AreaName3";
202
    protected static final String FURTHER_AREAS = "FurtherAreas";
203
    protected static final String COLLECTOR_STRING = "CollectorString";
204
    protected static final String COLLECTOR_NUMBER = "CollectorNumber";
205
    protected static final String COLLECTION_DATE = "CollectionDate";
206
    protected static final String SPECIMEN_IMAGE_URIS = "SpecimenImageURIs";
207
    protected static final String HERBARIUM_ABBREV = "HerbariumAbbrev";
208
    protected static final String MEDIA_SPECIMEN_URL = "MediaSpecimenURI";
209
    protected static final String PREFERREDSTABLE_ID = "PreferredStableId";
210
    protected static final String BARCODE = "Barcode";
211
    protected static final String ACCESSION_NUMBER = "AccessionNumber";
212
    protected static final String CATALOGUE_NUMBER = "CatalogueNumber ";
213
    //other specimen attributes
214

    
215

    
216
    //SimpleFacts
217
    protected static final String FACT_ID = "Fact_ID";
218
    protected static final String FACT_TEXT = "FactText";
219
    protected static final String LANGUAGE = "Language";
220
    protected static final String MEDIA_URI = "MediaURI";
221
    protected static final String FACT_CATEGORY = "FactCategory";
222

    
223
    // Specimen Facts
224
    protected static final String SPECIMEN_NOTES = "SpecimenNotes";
225
    protected static final String SPECIMEN_DESCRIPTION = "SpecimenDescription";
226

    
227
    // TaxonInteraction Facts
228
    protected static final String TAXON2_FK = "Taxon2_FK";
229
    protected static final String DESCRIPTION = "Description";
230

    
231

    
232
    //Geographic Area Facts
233
    protected static final String AREA_LABEL = "AreaLabel";
234
    protected static final String STATUS_LABEL = "StatusLabel";
235

    
236

    
237
    //FactSources
238
    protected static final String FACT_FK = "Fact_Fk";
239
    protected static final String REFERENCE_FK = "Reference_Fk";
240
    protected static final String NAME_IN_SOURCE_FK = "NameInSource_Fk";
241
    protected static final String FACT_TYPE = "FactType";
242

    
243
    //Annotations
244

    
245

    
246
  //Identifiers
247
    protected static final String EXTERNAL_NAME_IDENTIFIER = "ExternalIdentifier";
248
    protected static final String IDENTIFIER_TYPE = "IdentifierType";
249
    protected static final String FK = "ForeignKey";
250
    protected static final String REF_TABLE = "ReferencedTable";
251

    
252
    final static String[] homotypicGroupColumns(){
253
        return new String[]{HOMOTYPIC_GROUP_ID, HOMOTYPIC_GROUP_STRING, TYPE_STRING, TYPE_CACHE};
254
    }
255

    
256

    
257

    
258

    
259

    
260

    
261
    /**
262
     * @return
263
     */
264
    private static String[] compressedDistributionFactColumns() {
265
        return new String[]{FACT_ID, TAXON_FK, FACT_TEXT};
266
    }
267

    
268

    
269

    
270

    
271

    
272

    
273
    /**
274
     * @return
275
     */
276
    private Object usageFactColumns() {
277
        return new String[]{FACT_ID, TAXON_FK, FACT_TEXT, LANGUAGE, MEDIA_URI, FACT_CATEGORY};
278
    }
279

    
280
    final static String[] nameFactColumns() {
281
        return new String[]{FACT_ID, NAME_FK, FACT_TEXT, LANGUAGE, MEDIA_URI, FACT_CATEGORY};
282
    }
283
    final static String[] taxonInteractionFactsColumns(){
284
        return new String[]{FACT_ID, TAXON_FK, TAXON2_FK, DESCRIPTION};
285
    }
286

    
287
    final static String[] identifierColumns() {
288

    
289
        return new String[]{ FK, REF_TABLE, EXTERNAL_NAME_IDENTIFIER, IDENTIFIER_TYPE};
290
    }
291

    
292
    final static String[] mediaColumns() {
293
        return new String[]{ FACT_ID, TAXON_FK, NAME_FK, MEDIA_URI};
294
    }
295

    
296

    
297
    final static String[]  factSourcesColumns() {
298
        return new String[]{FACT_FK, REFERENCE_FK, NAME_IN_SOURCE_FK, FACT_TYPE};
299
    }
300

    
301
    final static String[] specimenFactsColumns() {
302
        return new String[]{FACT_ID, TAXON_FK, SPECIMEN_FK, SPECIMEN_DESCRIPTION, SPECIMEN_NOTES};
303
    }
304

    
305
    final static String[] commonNameFactsColumns() {
306
        return new String[]{FACT_ID, TAXON_FK, FACT_TEXT, LANGUAGE, AREA_LABEL};
307

    
308
    }
309
    final static String[] geographicAreaFactsColumns() {
310
        return new String[]{FACT_ID, TAXON_FK, AREA_LABEL, STATUS_LABEL};
311

    
312
    }
313
    final static String[] simpleFactsColumns() {
314
        return new String[]{FACT_ID, TAXON_FK, FACT_TEXT, LANGUAGE, MEDIA_URI, FACT_CATEGORY};
315

    
316
    }
317
   final static String[] nomenclaturalAuthorColumns() {
318
        return new String[]{AUTHOR_ID, ABBREV_AUTHOR, AUTHOR_TITLE, AUTHOR_GIVEN_NAME, AUTHOR_FAMILY_NAME, AUTHOR_PREFIX, AUTHOR_SUFFIX};
319
    }
320

    
321
    final static String[] nomenclaturalAuthorTeamRelColumns() {
322
        return new String[]{AUTHOR_TEAM_FK, AUTHOR_FK, AUTHOR_TEAM_SEQ_NUMBER};
323
    }
324

    
325
    final static String[] metaDataColumns(){
326
        return new String[]{INSTANCE_ID, INSTANCE_NAME, DATASET_TITLE, DATASET_CONTRIBUTOR, DATASET_CREATOR, DATASET_DESCRIPTION,
327
                DATASET_DOWNLOAD_LINK, DATASET_BASE_URL, DATASET_KEYWORDS, DATASET_LANDINGPAGE, DATASET_LANGUAGE, DATASET_LICENCE,
328
                DATASET_LOCATION, DATASET_RECOMMENDED_CITATTION};
329
    }
330
    final static String[] nameRelationColumns(){
331
        return new String[]{NAME1_FK, NAME2_FK, NAME_REL_TYPE};
332
    }
333
    final static String[] nameColumns(){
334
        return new String[]{NAME_ID, LSID, RANK, RANK_SEQUENCE,
335
                FULL_NAME_WITH_AUTHORS, FULL_NAME_NO_AUTHORS, GENUS_UNINOMIAL,
336
                INFRAGENERIC_RANK, INFRAGENERIC_EPITHET, SPECIFIC_EPITHET,
337
                INFRASPECIFIC_RANK, INFRASPECIFIC_EPITHET,
338
                BAS_EX_AUTHORTEAM_FK, BAS_AUTHORTEAM_FK, COMB_EX_AUTHORTEAM_FK, COMB_AUTHORTEAM_FK,
339
                AUTHOR_TEAM_STRING, REFERENCE_FK, PUBLICATION_TYPE, ABBREV_TITLE, FULL_TITLE,
340
                ABBREV_REF_AUTHOR, FULL_REF_AUTHOR, COLLATION, VOLUME_ISSUE,
341
                DETAIL, DATE_PUBLISHED, YEAR_PUBLISHED, VERBATIM_DATE, PROTOLOGUE_URI,
342
                NOM_STATUS, NOM_STATUS_ABBREV, HOMOTYPIC_GROUP_FK,
343
                HOMOTYPIC_GROUP_SEQ, PROTOLOGUE_TYPE_STATEMENT, TYPE_SPECIMEN, TYPE_STATEMENT
344
        };
345
    }
346
    final static String[] taxonColumns(){
347
        return new String[]{TAXON_ID, CLASSIFICATION_ID, CLASSIFICATION_TITLE, NAME_FK, PARENT_FK, SEC_REFERENCE_FK, SEC_REFERENCE, SORT_INDEX, EXCLUDED, STATUS_NOTES, PUBLISHED, UNPLACED, DOUBTFUL};
348
    }
349
    final static String[] synonymColumns(){
350
        return new String[]{SYNONYM_ID, TAXON_FK, NAME_FK, SYN_SEC_REFERENCE_FK, SYN_SEC_REFERENCE, SEC_REFERENCE_FK, SEC_REFERENCE,
351
                IS_PRO_PARTE, IS_PARTIAL, IS_MISAPPLIED, PUBLISHED};
352
    }
353
    final static String[] referenceColumns(){
354
        return new String[]{REFERENCE_ID, BIBLIO_SHORT_CITATION, REF_TITLE,ABBREV_REF_TITLE, DATE_PUBLISHED, EDITION, EDITOR, ISBN,ISSN, ORGANISATION, PAGES, PLACE_PUBLISHED, PUBLISHER,
355
                REF_ABSTRACT, SERIES_PART, VOLUME, YEAR, AUTHORSHIP_TITLE, AUTHOR_FK, IN_REFERENCE, INSTITUTION, LSID, SCHOOL, REF_TYPE, URI};
356
    }
357

    
358
    final static String[] typeDesignationColumns(){
359
        return new String[]{SPECIMEN_FK, NAME_FK, TYPE_VERBATIM_CITATION, TYPE_CATEGORY, TYPE_DESIGNATED_BY_STRING, TYPE_DESIGNATED_BY_REF_FK};
360
    }
361

    
362
    final static String[] specimenColumns() {
363
        return new String[]{SPECIMEN_ID, SPECIMEN_CITATION, FIELDUNIT_CITATION, LOCALITY, COUNTRY, AREA_CATEGORY1, AREA_NAME1, AREA_CATEGORY2, AREA_NAME2, AREA_CATEGORY3, AREA_NAME3,
364
                FURTHER_AREAS, COLLECTOR_STRING, COLLECTOR_NUMBER, COLLECTION_DATE, SPECIMEN_IMAGE_URIS, HERBARIUM_ABBREV, MEDIA_SPECIMEN_URL, PREFERREDSTABLE_ID, BARCODE, CATALOGUE_NUMBER, ACCESSION_NUMBER};
365
    }
366

    
367
    private String tableName;
368
    private String[] columnNames;
369

    
370
// ************** CONSTRUCTOR *******************/
371

    
372
    private CdmLightExportTable(String tableName, String[] columnNames){
373
        this.tableName = tableName;
374
        this.columnNames = columnNames;
375
    }
376

    
377
// ****************** GETTER / SETTER *************/
378

    
379
    public String getTableName() {return tableName;}
380

    
381
    public int getSize(){ return columnNames.length;}
382

    
383
    public String[] getColumnNames(){return columnNames;}
384

    
385
    public int getIndex(String columnName) {
386
        int index= 0;
387
        for(String column : getColumnNames()){
388
            if (column.equals(columnName)){
389
                return index;
390
            }
391
            index++;
392
        }
393
        return -1;
394
    }
395
}
(5-5/6)