Project

General

Profile

Download (14.7 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("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 IS_PRO_PARTE = "IsProParteSynonym";
49
    protected static final String IS_PARTIAL = "IsPartial";
50
    protected static final String IS_MISAPPLIED = "IsMisapplied";
51
    //Reference
52
    protected static final String REFERENCE_ID = "Reference_ID";
53
    protected static final String BIBLIO_SHORT_CITATION = "BibliographicShortCitation";
54
    protected static final String REF_TITLE = "Title";
55
    protected static final String ABBREV_REF_TITLE = "Abbrev. Title";
56
    protected static final String DATE_PUBLISHED = "DatePublished";
57
    protected static final String EDITION = "Edition";
58
    protected static final String EDITOR= "Editor";
59
    protected static final String ISBN = "ISBN";
60
    protected static final String ISSN = "ISSN";
61
    protected static final String ORGANISATION = "Organisation";
62
    protected static final String PAGES = "Pages";
63
    protected static final String PLACE_PUBLISHED = "Place Published";
64
    protected static final String PUBLISHER = "Publisher";
65
    protected static final String REF_ABSTRACT = "Reference Abstract";
66
    protected static final String SERIES_PART = "Series Part";
67
    protected static final String VOLUME = "Volume";
68
    protected static final String YEAR = "Year";
69
    protected static final String AUTHORSHIP_TITLE = "Authorship";
70

    
71

    
72
    protected static final String IN_REFERENCE = "inReference";
73
    protected static final String INSTITUTION = "Institution";
74
   // protected static final String LSID = "LSID";
75
    protected static final String SCHOOL = "School";
76
    protected static final String REF_TYPE = "Reference Type";
77
    protected static final String URI = "URI";
78

    
79
    //Name
80
    protected static final String NAME_ID = "Name_ID";
81
//    protected static final String TROPICOS_ID = "Tropicos_ID";
82
//    protected static final String IPNI_ID = "IPNI_ID";
83
//    protected static final String WFO_ID = "WorldFloraOnline_ID";
84
    protected static final String LSID = "LSID";
85
    protected static final String RANK = "Rank";
86
    protected static final String RANK_SEQUENCE = "Rank_Sequence";
87
    protected static final String FULL_NAME_WITH_AUTHORS = "FullNameWithAuthors";
88
    protected static final String FULL_NAME_NO_AUTHORS = "FullNameNoAuthors";
89
    protected static final String GENUS_UNINOMIAL = "GenusOrUninomial";
90
    protected static final String INFRAGENERIC_RANK = "InfragenericRank";
91
    protected static final String INFRAGENERIC_EPITHET = "InfraGenericEpithet";
92
    protected static final String SPECIFIC_EPITHET = "SpecificEpithet";
93
    protected static final String INFRASPECIFIC_RANK = "InfraspecificRank";
94
    protected static final String INFRASPECIFIC_EPITHET = "InfraSpecificEpithet ";
95
    protected static final String BAS_EX_AUTHORTEAM_FK = "BasionymExAuthorTeam_Fk";
96
    protected static final String BAS_AUTHORTEAM_FK = "BasionymAuthorTeam_Fk";
97
    protected static final String COMB_EX_AUTHORTEAM_FK = "PublishingExAuthorTeam_Fk";
98
    protected static final String COMB_AUTHORTEAM_FK = "PublishingAuthorTeam_Fk";
99
    protected static final String AUTHOR_TEAM_STRING = "AuthorTeamString";
100
   // protected static final String REFERENCE_FK = "Reference_Fk"
101
    protected static final String PUBLICATION_TYPE = "PublicationType";
102
    protected static final String ABBREV_TITLE = "AbbreviatedTitle";
103
    protected static final String FULL_TITLE = "FullTitle";
104
    protected static final String ABBREV_REF_AUTHOR = "AbbreviatedInRefAuthor";
105
    protected static final String FULL_REF_AUTHOR = "FullInRefAuthor";
106
    protected static final String COLLATION = "Collation";
107
    protected static final String VOLUME_ISSUE = "Volume_Issue";
108
    protected static final String DETAIL = "Detail";
109
    protected static final String YEAR_PUBLISHED = "YearPublished";
110
    protected static final String VERBATIM_DATE = "VerbatimDate";
111
    protected static final String PROTOLOGUE_URI = "ProtologueURI";
112
    protected static final String NOM_STATUS = "NomenclaturalStatus";
113
    protected static final String NOM_STATUS_ABBREV = "NomenclaturalStatusAbbreviation";
114
    protected static final String HOMOTYPIC_GROUP_FK = "HomotypicGroup_Fk";
115
    protected static final String HOMOTYPIC_GROUP_SEQ = "HomotypicGroupSequenceNumber";
116

    
117

    
118
    //Name Relationship
119
    protected static final String NAME1_FK = "Name1_FK";
120
    protected static final String NAME2_FK = "Name2_FK";
121
    protected static final String NAME_REL_TYPE = "NameRelationship_Type";
122

    
123
    //CDM MetaData
124
    protected static final String INSTANCE_ID = "EditInstance_ID";
125
    protected static final String INSTANCE_NAME = "EditInstanceName";
126

    
127
    //Homotypic Group
128
    protected static final String HOMOTYPIC_GROUP_ID = "HomotypicGroup_ID";
129
    protected static final String HOMOTYPIC_GROUP_STRING = "HomotypicGroupString";
130
    protected static final String TYPE_STRING = "TypeString";
131

    
132
    //NomenclaturalAuthor
133
    protected static final String AUTHOR_ID = "Author_ID";
134
    protected static final String ABBREV_AUTHOR = "AbbrevAuthor";
135
    protected static final String AUTHOR_TITLE = "AuthorTitle";
136
    protected static final String AUTHOR_GIVEN_NAME = "AuthorFirstName";
137
    protected static final String AUTHOR_FAMILY_NAME = "AuthorLastName";
138
    protected static final String AUTHOR_PREFIX = "AuthorPrefix";
139
    protected static final String AUTHOR_SUFFIX = "AuthorSuffix";
140

    
141
  //Nomenclatural Author AuthorTeam Relations
142

    
143
    protected static final String AUTHOR_FK = "Author_Fk";
144
    protected static final String AUTHOR_TEAM_FK = "AuthorTeam_Fk";
145
    protected static final String AUTHOR_TEAM_SEQ_NUMBER = "SequenceNumber";
146

    
147
    //TypeDesignations
148

    
149
    protected static final String SPECIMEN_FK = "Specimen_Fk";
150
    protected static final String TYPE_VERBATIM_CITATION = "TypeVerbatimCitation";
151
    protected static final String TYPE_CATEGORY = "TypeCategory";
152
    protected static final String TYPE_DESIGNATED_BY_STRING = "TypeDesignatedByString";
153
    protected static final String TYPE_DESIGNATED_BY_REF_FK = "TypeDesignationByRef_Fk";
154

    
155
    //Specimen
156

    
157
    protected static final String SPECIMEN_ID = "Specimen_Id";
158
    protected static final String SPECIMEN_CITATION = "SpecimenCitation";
159
    protected static final String LOCALITY= "Locality";
160
    protected static final String COUNTRY = "Country";
161
    protected static final String AREA_CATEGORY1 = "AreaCategory1";
162
    protected static final String AREA_NAME1 = "AreaName1";
163
    protected static final String AREA_CATEGORY2 = "AreaCategory2";
164
    protected static final String AREA_NAME2 = "AreaName2";
165
    protected static final String AREA_CATEGORY3 = "AreaCategory3";
166
    protected static final String AREA_NAME3 = "AreaName3";
167
    protected static final String FURTHER_AREAS = "FurtherAreas";
168
    protected static final String COLLECTOR_STRING = "CollectorString";
169
    protected static final String COLLECTOR_NUMBER = "CollectorNumber";
170
    protected static final String COLLECTION_DATE = "CollectionDate";
171
    protected static final String SPECIMEN_IMAGE_URIS = "SpecimenImageURIs";
172
    protected static final String HERBARIUM_ABBREV = "HerbariumAbbrev";
173
    protected static final String MEDIA_SPECIMEN_URL = "MediaSpecimenURI";
174
    //other specimen attributes
175

    
176

    
177
    //SimpleFacts
178
    protected static final String FACT_ID = "Fact_Id";
179
    protected static final String FACT_TEXT = "FactText";
180
    protected static final String LANGUAGE = "Language";
181
    protected static final String MEDIA_URI = "MediaURI";
182
    protected static final String FACT_CATEGORY = "FactCategory";
183

    
184
    // Specimen Facts
185
    protected static final String SPECIMEN_NOTES = "Specimen Notes";
186
    protected static final String SPECIMEN_DESCRIPTION = "Specimen Description";
187

    
188

    
189
    //Geographic Area Facts
190
    protected static final String AREA_LABEL = "AreaLabel";
191
    protected static final String STATUS_LABEL = "StatusLabel";
192

    
193

    
194
    //FactSources
195
    protected static final String FACT_FK = "Fact_Fk";
196
    protected static final String REFERENCE_FK = "Reference_Fk";
197
    protected static final String NAME_IN_SOURCE_FK = "NameInSource_Fk";
198
    protected static final String FACT_TYPE = "FactType";
199

    
200
  //Identifiers
201
    protected static final String IDENTIFIER_IDS = "Identifier_IDs";
202
    protected static final String IDENTIFIER_TYPE = "Identifier_Type";
203

    
204
    final static String[] homotypicGroupColumns(){
205
        return new String[]{HOMOTYPIC_GROUP_ID, HOMOTYPIC_GROUP_STRING, TYPE_STRING};
206
    }
207

    
208

    
209

    
210

    
211

    
212
    /**
213
     * @return
214
     */
215
    private static String[] identifierColumns() {
216

    
217
        return new String[]{ NAME_FK, IDENTIFIER_IDS, IDENTIFIER_TYPE};
218
    }
219
    /**
220
     * @return
221
     */
222
    private static String[] mediaColumns() {
223
        return new String[]{ FACT_ID, TAXON_FK, NAME_FK, MEDIA_URI};
224
    }
225

    
226

    
227
    final static String[]  factSourcesColumns() {
228
        return new String[]{FACT_FK, REFERENCE_FK, NAME_IN_SOURCE_FK, FACT_TYPE};
229
    }
230

    
231
    final static String[] specimenFactsColumns() {
232
        return new String[]{FACT_ID, TAXON_FK, SPECIMEN_FK, SPECIMEN_DESCRIPTION, SPECIMEN_NOTES};
233
    }
234

    
235
    final static String[] commonNameFactsColumns() {
236
        return new String[]{FACT_ID, TAXON_FK, FACT_TEXT, LANGUAGE, AREA_LABEL};
237

    
238
    }
239
    final static String[] geographicAreaFactsColumns() {
240
        return new String[]{FACT_ID, TAXON_FK, AREA_LABEL, STATUS_LABEL};
241

    
242
    }
243
    final static String[] simpleFactsColumns() {
244
        return new String[]{FACT_ID, TAXON_FK, NAME_FK, FACT_TEXT, LANGUAGE, MEDIA_URI, FACT_CATEGORY};
245

    
246
    }
247
   final static String[] nomenclaturalAuthorColumns() {
248
        return new String[]{AUTHOR_ID, ABBREV_AUTHOR, AUTHOR_TITLE, AUTHOR_GIVEN_NAME, AUTHOR_FAMILY_NAME, AUTHOR_PREFIX, AUTHOR_SUFFIX};
249
    }
250

    
251
    final static String[] nomenclaturalAuthorTeamRelColumns() {
252
        return new String[]{AUTHOR_TEAM_FK, AUTHOR_FK, AUTHOR_TEAM_SEQ_NUMBER};
253
    }
254

    
255
    final static String[] metaDataColumns(){
256
        return new String[]{INSTANCE_ID, INSTANCE_NAME};
257
    }
258
    final static String[] nameRelationColumns(){
259
        return new String[]{NAME1_FK, NAME2_FK, NAME_REL_TYPE};
260
    }
261
    final static String[] nameColumns(){
262
        return new String[]{NAME_ID, LSID, RANK, RANK_SEQUENCE,
263
                FULL_NAME_WITH_AUTHORS, FULL_NAME_NO_AUTHORS, GENUS_UNINOMIAL,
264
                INFRAGENERIC_RANK, INFRAGENERIC_EPITHET, SPECIFIC_EPITHET,
265
                INFRASPECIFIC_RANK, INFRASPECIFIC_EPITHET,
266
                BAS_EX_AUTHORTEAM_FK, BAS_AUTHORTEAM_FK, COMB_EX_AUTHORTEAM_FK, COMB_AUTHORTEAM_FK,
267
                AUTHOR_TEAM_STRING, REFERENCE_FK, PUBLICATION_TYPE, ABBREV_TITLE, FULL_TITLE,
268
                ABBREV_REF_AUTHOR, FULL_REF_AUTHOR, COLLATION, VOLUME_ISSUE,
269
                DETAIL, DATE_PUBLISHED, YEAR_PUBLISHED, VERBATIM_DATE, PROTOLOGUE_URI,
270
                NOM_STATUS, NOM_STATUS_ABBREV, HOMOTYPIC_GROUP_FK,
271
                HOMOTYPIC_GROUP_SEQ
272
        };
273
    }
274
    final static String[] taxonColumns(){
275
        return new String[]{TAXON_ID, CLASSIFICATION_ID, CLASSIFICATION_TITLE, NAME_FK, PARENT_FK, SEC_REFERENCE_FK, SEC_REFERENCE};
276
    }
277
    final static String[] synonymColumns(){
278
        return new String[]{SYNONYM_ID, TAXON_FK, NAME_FK, SEC_REFERENCE_FK, SEC_REFERENCE, IS_PRO_PARTE};
279
    }
280
    final static String[] referenceColumns(){
281
        return new String[]{REFERENCE_ID, BIBLIO_SHORT_CITATION, REF_TITLE,ABBREV_REF_TITLE, DATE_PUBLISHED, EDITION, EDITOR, ISBN,ISSN, ORGANISATION, PAGES, PLACE_PUBLISHED, PUBLISHER,
282
                REF_ABSTRACT, SERIES_PART, VOLUME, YEAR, AUTHORSHIP_TITLE, AUTHOR_FK, IN_REFERENCE, INSTITUTION, LSID, SCHOOL, REF_TYPE, URI};
283
    }
284

    
285
    final static String[] typeDesignationColumns(){
286
        return new String[]{SPECIMEN_FK, NAME_FK, TYPE_VERBATIM_CITATION, TYPE_CATEGORY, TYPE_DESIGNATED_BY_STRING, TYPE_DESIGNATED_BY_REF_FK};
287
    }
288

    
289
    final static String[] specimenColumns() {
290
        return new String[]{SPECIMEN_ID, SPECIMEN_CITATION, LOCALITY, COUNTRY, AREA_CATEGORY1, AREA_NAME1, AREA_CATEGORY2, AREA_NAME2, AREA_CATEGORY3, AREA_NAME3,
291
                FURTHER_AREAS, COLLECTOR_STRING, COLLECTOR_NUMBER, COLLECTION_DATE, SPECIMEN_IMAGE_URIS, HERBARIUM_ABBREV, MEDIA_SPECIMEN_URL};
292
    }
293

    
294

    
295

    
296
    private String tableName;
297
    private String[] columnNames;
298

    
299
// ************** CONSTRUCTOR *******************/
300

    
301
    private CdmLightExportTable(String tableName, String[] columnNames){
302
        this.tableName = tableName;
303
        this.columnNames = columnNames;
304
    }
305

    
306
// ****************** GETTER / SETTER *************/
307

    
308
    public String getTableName() {return tableName;}
309

    
310
    public int getSize(){ return columnNames.length;}
311

    
312
    public String[] getColumnNames(){return columnNames;}
313

    
314
    /**
315
     * @param taxonId
316
     * @return
317
     */
318
    public int getIndex(String columnName) {
319
        int index= 0;
320
        for(String column : getColumnNames()){
321
            if (column.equals(columnName)){
322
                return index;
323
            }
324
            index++;
325
        }
326
        return -1;
327
    }
328

    
329

    
330
}
(5-5/5)