Project

General

Profile

Download (7.74 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.common.TermType;
27
import eu.etaxonomy.cdm.model.common.TermVocabulary;
28

    
29
/**
30
 * The class representing categories of {@link SynonymRelationship synonym relationships}
31
 * (like "heterotypic synonym of").
32
 * <P>
33
 * A standard (ordered) list of synonym relationship 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
 * relationship 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
 * @created 08-Nov-2007 13:06:55
45
 */
46
@XmlAccessorType(XmlAccessType.FIELD)
47
@XmlType(name = "SynonymRelationshipType")
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.common.DefinedTermBase")
51
@Audited
52
public class SynonymRelationshipType extends RelationshipTermBase<SynonymRelationshipType> {
53
	private static final long serialVersionUID = -3775216614202923889L;
54
	@SuppressWarnings("unused")
55
	private static final Logger logger = Logger.getLogger(SynonymRelationshipType.class);
56

    
57
	protected static Map<UUID, SynonymRelationshipType> 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 SynonymRelationshipType() {
73
		super(TermType.SynonymRelationshipType);
74
	}
75

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

    
94

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

    
97
	/* (non-Javadoc)
98
	 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
99
	 */
100
	@Override
101
	public void resetTerms(){
102
		termMap = null;
103
	}
104

    
105

    
106
	protected static SynonymRelationshipType getTermByUuid(UUID uuid){
107
        if (termMap == null || termMap.isEmpty()){
108
            return getTermByClassAndUUID(SynonymRelationshipType.class, uuid);
109
        } else {
110
            return termMap.get(uuid);
111
        }
112
	}
113

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

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

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

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

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

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

    
184
	public static SynonymRelationshipType POTENTIAL_COMBINATION_OF() {
185
		return getTermByUuid(uuidPotentialCombinationOf);
186
	}
187

    
188

    
189
//	@Override
190
//	public SynonymRelationshipType readCsvLine(Class<SynonymRelationshipType> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms) {
191
//		return super.readCsvLine(termClass, csvLine, terms);
192
//	}
193

    
194
	@Override
195
	protected void setDefaultTerms(TermVocabulary<SynonymRelationshipType> termVocabulary) {
196
		termMap = new HashMap<UUID, SynonymRelationshipType>();
197
		for (SynonymRelationshipType term : termVocabulary.getTerms()){
198
			termMap.put(term.getUuid(), term);
199
		}
200
	}
201

    
202

    
203

    
204
}
(9-9/21)