ref #6314: add some parameters to OutputModel table
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / outputmodel / OutputModelTable.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.outputmodel;
10
11 /**
12 * An enumeration with each instance representing a table type in the Output Model.
13 *
14 * @author a.mueller
15 * @date 15.03.2017
16 */
17 public enum OutputModelTable {
18 METADATA("Metadata", metaDataColumns()),
19 SCIENTIFIC_NAME("ScientificName", nameColumns()),
20 NAME_RELATIONSHIP("NameRelationship",nameRelationColumns()),
21 HOMOTYPIC_GROUP("HomotypicGroup",homotypicGroupColumns()),
22 NOMENCLATURAL_AUTHOR("NomenclaturalAuthor", new String[]{}),
23 NOMENCLATURAL_AUTHOR_TEAM_RELATION("NomenclaturalAuthorTeamRelation", new String[]{}),
24 TYPE_DESIGNATION("TypeDesignation", new String[]{}),
25 SPECIMEN("Specimen", new String[]{}),
26 TAXON("Taxon", taxonColumns()),
27 SYNONYM("Synonym", synonymColumns()),
28 REFERENCE("Reference", referenceColumns()),
29 SIMPLE_FACT("SimpleFact", new String[]{}),
30 SPECIMEN_FACT("SpecimenFact", new String[]{}),
31 GEOGRAPHIC_AREA_FACT("GeographicAreaFact", new String[]{}),
32 COMMON_NAME_FACT("CommonNameFact", new String[]{}),
33 ;
34
35 //Taxon/Synonym
36 protected static final String NAME_FK = "Name_FK";
37 protected static final String TAXON_ID = "Taxon_ID";
38 protected static final String TAXON_FK = "Taxon_FK";
39 protected static final String SYNONYM_ID = "Synonym_ID";
40 protected static final String PARENT_FK = "Parent_FK";
41 protected static final String SEC_REFERENCE_FK = "SecReference_FK";
42 protected static final String SEC_REFERENCE = "SecReference";
43
44 //Reference
45 protected static final String REFERENCE_ID = "Reference_ID";
46 protected static final String BIBLIO_SHORT_CITATION = "BibliographicShortCitation";
47 protected static final String REF_TITLE = "Title";
48 protected static final String DATE_PUBLISHED = "DatePublished";
49 //TBC
50
51 //Name
52 protected static final String NAME_ID = "Name_ID";
53 protected static final String TROPICOS_ID = "Tropicos_ID";
54 protected static final String IPNI_ID = "IPNI_ID";
55 protected static final String RANK = "Rank";
56 protected static final String RANK_SEQUENCE = "Name_ID";
57 protected static final String FULL_NAME_WITH_AUTHORS = "FullNameWithAuthors";
58 protected static final String FULL_NAME_NO_AUTHORS = "FullNameNoAuthors";
59 protected static final String GENUS_UNINOMIAL = "GenusOrUninomial";
60 protected static final String INFRAGENERIC_RANK = "InfragenericRank";
61 protected static final String INFRAGENERIC_EPITHET = "InfraGenericEpithet";
62 protected static final String SPECIFIC_EPITHET = "SpecificEpithet";
63 protected static final String INFRASPECIFIC_RANK = "InfraspecificRank";
64 protected static final String INFRASPECIFIC_EPITHET = "InfraSpecificEpithet ";
65 protected static final String BAS_EX_AUTHORTEAM_FK = "BasionymExAuthorTeam_Fk";
66 protected static final String BAS_AUTHORTEAM_FK = "BasionymExAuthorTeam_Fk";
67 protected static final String COMB_EX_AUTHORTEAM_FK = "PublishingExAuthorTeam_Fk";
68 protected static final String COMB_AUTHORTEAM_FK = "PublishingAuthorTeam_Fk";
69 protected static final String AUTHOR_TEAM_STRING = "AuthorTeamString";
70 protected static final String PUBLICATION_TYPE = "PublicationType";
71 protected static final String ABBREV_TITLE = "AbbreviatedTitle";
72 protected static final String FULL_TITLE = "FullTitle";
73 protected static final String ABBREV_REF_AUTHOR = "AbbreviatedRefAuthor";
74 protected static final String FULL_REF_AUTHOR = "FullRefAuthor";
75 protected static final String COLLATION = "Collation";
76 protected static final String VOLUME_ISSUE = "Volume_Issue";
77 protected static final String DETAIL = "Detail";
78 protected static final String YEAR_PUBLISHED = "YearPublished";
79 protected static final String TITLE_PAGE_YEAR = "TitlePageYear";
80 protected static final String PROTOLOGUE_URI = "ProtologueURI";
81 protected static final String NOM_STATUS = "NomenclaturalStatus";
82 protected static final String NOM_STATUS_ABBREV = "NomenclaturalStatusAbbreviation";
83 protected static final String HOMOTYPIC_GROUP_FK = "HomotypicGroup_Fk";
84 protected static final String HOMOTYPIC_GROUP_SEQ = "HomotypicGroupSequenceNumber";
85 protected static final String TYPE_STRING = "TypeString";
86
87 //Name Relationship
88 protected static final String NAME1_FK = "Name1_FK";
89 protected static final String NAME2_FK = "Name2_FK";
90 protected static final String NAME_REL_TYPE = "NameRelationship_Type";
91
92 //CDM MetaData
93 protected static final String INSTANCE_ID = "EditInstance_ID";
94 protected static final String INSTANCE_NAME = "EditInstanceName";
95
96 //Homotypic Group
97 protected static final String HOMOTYPIC_GROUP_ID = "HomotypicGroup_ID";
98 protected static final String HOMOTYPIC_GROUP_STRING = "HomotypicGroupString";
99
100
101
102
103 final static String[] homotypicGroupColumns(){
104 return new String[]{INSTANCE_ID, INSTANCE_NAME};
105 }
106 final static String[] metaDataColumns(){
107 return new String[]{INSTANCE_ID, INSTANCE_NAME};
108 }
109 final static String[] nameRelationColumns(){
110 return new String[]{NAME1_FK, NAME2_FK, NAME_REL_TYPE};
111 }
112 final static String[] nameColumns(){
113 return new String[]{NAME_ID, TROPICOS_ID, IPNI_ID, RANK, RANK_SEQUENCE,
114 FULL_NAME_WITH_AUTHORS, FULL_NAME_NO_AUTHORS, GENUS_UNINOMIAL,
115 INFRAGENERIC_RANK, INFRAGENERIC_EPITHET, SPECIFIC_EPITHET,
116 INFRASPECIFIC_RANK, INFRASPECIFIC_EPITHET,
117 BAS_EX_AUTHORTEAM_FK, BAS_AUTHORTEAM_FK, COMB_EX_AUTHORTEAM_FK, COMB_AUTHORTEAM_FK,
118 AUTHOR_TEAM_STRING, PUBLICATION_TYPE, ABBREV_TITLE, FULL_TITLE,
119 ABBREV_REF_AUTHOR, FULL_REF_AUTHOR, COLLATION, VOLUME_ISSUE,
120 DETAIL, YEAR_PUBLISHED, TITLE_PAGE_YEAR, PROTOLOGUE_URI,
121 NOM_STATUS, NOM_STATUS_ABBREV, HOMOTYPIC_GROUP_FK,
122 HOMOTYPIC_GROUP_SEQ, TYPE_STRING
123 };
124 }
125 final static String[] taxonColumns(){
126 return new String[]{TAXON_ID, NAME_FK, PARENT_FK, SEC_REFERENCE_FK, SEC_REFERENCE};
127 }
128 final static String[] synonymColumns(){
129 return new String[]{SYNONYM_ID, TAXON_FK, NAME_FK, SEC_REFERENCE_FK, SEC_REFERENCE};
130 }
131 final static String[] referenceColumns(){
132 return new String[]{REFERENCE_ID, BIBLIO_SHORT_CITATION, REF_TITLE, DATE_PUBLISHED};
133 }
134
135 private String tableName;
136 private String[] columnNames;
137
138 // ************** CONSTRUCTOR *******************/
139
140 private OutputModelTable(String tableName, String[] columnNames){
141 this.tableName = tableName;
142 this.columnNames = columnNames;
143 }
144
145 // ****************** GETTER / SETTER *************/
146
147 public String getTableName() {return tableName;}
148
149 public int getSize(){ return columnNames.length;}
150
151 public String[] getColumnNames(){return columnNames;}
152
153 /**
154 * @param taxonId
155 * @return
156 */
157 public int getIndex(String columnName) {
158 int index= 0;
159 for(String column : getColumnNames()){
160 if (column.equals(columnName)){
161 return index;
162 }
163 index++;
164 }
165 return -1;
166 }
167
168
169 }