Project

General

Profile

Download (6.91 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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

    
10
package eu.etaxonomy.cdm.model.taxon;
11

    
12

    
13
import java.util.HashMap;
14
import java.util.Map;
15
import java.util.UUID;
16

    
17
import javax.persistence.Entity;
18
import javax.xml.bind.annotation.XmlAccessType;
19
import javax.xml.bind.annotation.XmlAccessorType;
20
import javax.xml.bind.annotation.XmlType;
21

    
22
import org.apache.log4j.Logger;
23
import org.hibernate.envers.Audited;
24

    
25
import eu.etaxonomy.cdm.model.common.RelationshipTermBase;
26
import eu.etaxonomy.cdm.model.term.TermType;
27
import eu.etaxonomy.cdm.model.term.TermVocabulary;
28

    
29
/**
30
 * The class representing categories of {@link Synonym synonyms}
31
 * (like "heterotypic synonym of").
32
 * <P>
33
 * A standard (ordered) list of synonym type instances will be
34
 * automatically created as the project starts. But this class allows to extend
35
 * this standard list by creating new instances of additional synonym
36
 * types if needed.
37
 * <P>
38
 * This class corresponds in part to: <ul>
39
 * <li> TaxonRelationshipTerm according to the TDWG ontology
40
 * <li> RelationshipType according to the TCS
41
 * </ul>
42
 *
43
 * @author m.doering
44
 * @since 08-Nov-2007 13:06:55
45
 */
46
@XmlAccessorType(XmlAccessType.FIELD)
47
@XmlType(name = "SynonymType")
48
@Entity
49
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
50
//@Indexed(index = "eu.etaxonomy.cdm.model.term.DefinedTermBase")
51
@Audited
52
public class SynonymType extends RelationshipTermBase<SynonymType> {
53
	private static final long serialVersionUID = -3775216614202923889L;
54
	@SuppressWarnings("unused")
55
	private static final Logger logger = Logger.getLogger(SynonymType.class);
56

    
57
	protected static Map<UUID, SynonymType> termMap = null;
58

    
59
	public static final UUID uuidSynonymOf = UUID.fromString("1afa5429-095a-48da-8877-836fa4fe709e");
60
	public static final UUID uuidHomotypicSynonymOf = UUID.fromString("294313a9-5617-4ed5-ae2d-c57599907cb2");
61
	public static final UUID uuidHeterotypicSynonymOf = UUID.fromString("4c1e2c59-ca55-41ac-9a82-676894976084");
62
	public static final UUID uuidInferredSynonymOf = UUID.fromString("cb5bad12-9dbc-4b38-9977-162e45089c11");
63
	public static final UUID uuidInferredGenusOf = UUID.fromString("f55a574b-c1de-45cc-9ade-1aa2e098c3b5");
64
	public static final UUID uuidInferredEpithetOf = UUID.fromString("089c1926-eb36-47e7-a2d1-fd5f3918713d");
65
	public static final UUID uuidPotentialCombinationOf = UUID.fromString("7c45871f-6dc5-40e7-9f26-228318d0f63a");
66

    
67

    
68
//********************************** CONSTRUCTOR *********************************/
69

    
70
  	//for hibernate use only
71
  	@Deprecated
72
  	protected SynonymType() {
73
		super(TermType.SynonymType);
74
	}
75

    
76
	/**
77
	 * Class constructor: creates an additional synonym type
78
	 * instance with a description (in the {@link Language#DEFAULT() default language}), a label and
79
	 * a label abbreviation. Synonym types can be neither
80
	 * symmetric nor transitive.
81
	 *
82
	 * @param	term  		 the string (in the default language) describing the
83
	 * 						 new synonym type to be created
84
	 * @param	label  		 the string identifying the new synonym
85
	 * 						 type to be created
86
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
87
	 * 						 new synonym type to be created
88
	 * @see 				 #SynonymType()
89
	 */
90
	private SynonymType(String term, String label, String labelAbbrev) {
91
		super(TermType.SynonymType, term, label, labelAbbrev, false, false);
92
	}
93

    
94

    
95
//************************** METHODS ********************************
96

    
97
	@Override
98
	public void resetTerms(){
99
		termMap = null;
100
	}
101

    
102

    
103
	protected static SynonymType getTermByUuid(UUID uuid){
104
        if (termMap == null || termMap.isEmpty()){
105
            return getTermByClassAndUUID(SynonymType.class, uuid);
106
        } else {
107
            return termMap.get(uuid);
108
        }
109
	}
110

    
111
	/**
112
	 * Returns the synonym type "is synonym of". This indicates
113
	 * that the reference asserting the synonym relationship does not know
114
	 * whether both {@link name.TaxonName taxon names} involved are typified by the same type or
115
	 * not.
116
	 *
117
	 * @see		#HOMOTYPIC_SYNONYM_OF()
118
	 * @see		#HETEROTYPIC_SYNONYM_OF()
119
	 */
120
	public static final SynonymType SYNONYM_OF(){
121
		return getTermByUuid(uuidSynonymOf);
122
	}
123

    
124
	/**
125
	 * Returns the synonym relationship type "is homotypic synonym of"
126
	 * ("is nomenclatural synonym of" in zoology). This indicates that the
127
	 * the reference asserting the synonym relationship holds that
128
	 * the {@link name.TaxonName taxon name} used as a {@link Synonym synonym} and the taxon name used as the
129
	 * ("accepted/correct") {@link Taxon taxon} are typified by the same type.
130
	 * In this case they should belong to the same {@link name.HomotypicalGroup homotypical group}.
131
	 *
132
	 * @see		#HETEROTYPIC_SYNONYM_OF()
133
	 * @see		#SYNONYM_OF()
134
	 */
135
	public static final SynonymType HOMOTYPIC_SYNONYM_OF(){
136
		return getTermByUuid(uuidHomotypicSynonymOf);
137
	}
138

    
139
	/**
140
	 * Returns the synonym relationship type "is heterotypic synonym of"
141
	 * ("is taxonomic synonym of" in zoology). This indicates that the
142
	 * the reference asserting the synonym relationship holds that
143
	 * the {@link name.TaxonName taxon name} used as a {@link Synonym synonym} and the taxon name used as the
144
	 * ("accepted/correct") {@link Taxon taxon} are not typified by the same type.
145
	 * In this case they should not belong to the same {@link name.HomotypicalGroup homotypical group}.
146
	 *
147
	 * @see		#HOMOTYPIC_SYNONYM_OF()
148
	 * @see		#SYNONYM_OF()
149
	 */
150
	public static final SynonymType HETEROTYPIC_SYNONYM_OF(){
151
		return getTermByUuid(uuidHeterotypicSynonymOf);
152
	}
153

    
154
	/**
155
	 * Returns the synonym relationship type "is inferred synonym of".
156
	 * This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
157
	 * level is derived from a genus synonymy.
158
	 */
159
	public static final SynonymType INFERRED_SYNONYM_OF(){
160
		return getTermByUuid(uuidInferredSynonymOf);
161
	}
162

    
163
	/**
164
	 * Returns the synonym relationship type "is inferred genus of".
165
	 * This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
166
	 * level is derived from a epithet synonymy.
167
	 */
168
	public static final SynonymType INFERRED_GENUS_OF(){
169
		return getTermByUuid(uuidInferredGenusOf);
170
	}
171

    
172
	/**
173
	 * Returns the synonym relationship type "is inferred synonym of".
174
	 * This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
175
	 * level is derived from a genus synonymy.
176
	 */
177
	public static final SynonymType INFERRED_EPITHET_OF(){
178
		return getTermByUuid(uuidInferredEpithetOf);
179
	}
180

    
181
	public static SynonymType POTENTIAL_COMBINATION_OF() {
182
		return getTermByUuid(uuidPotentialCombinationOf);
183
	}
184

    
185

    
186
	@Override
187
	protected void setDefaultTerms(TermVocabulary<SynonymType> termVocabulary) {
188
		termMap = new HashMap<>();
189
		for (SynonymType term : termVocabulary.getTerms()){
190
			termMap.put(term.getUuid(), term);
191
		}
192
	}
193

    
194

    
195

    
196
}
(8-8/21)