Project

General

Profile

Download (7.72 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
import org.hibernate.search.annotations.Indexed;
25

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

    
30
/**
31
 * The class representing categories of {@link SynonymRelationship synonym relationships}
32
 * (like "heterotypic synonym of").
33
 * <P>
34
 * A standard (ordered) list of synonym relationship type instances will be
35
 * automatically created as the project starts. But this class allows to extend
36
 * this standard list by creating new instances of additional synonym
37
 * relationship types if needed. 
38
 * <P>
39
 * This class corresponds in part to: <ul>
40
 * <li> TaxonRelationshipTerm according to the TDWG ontology
41
 * <li> RelationshipType according to the TCS
42
 * </ul>
43
 * 
44
 * @author m.doering
45
 * @created 08-Nov-2007 13:06:55
46
 */
47
@XmlAccessorType(XmlAccessType.FIELD)
48
@XmlType(name = "SynonymRelationshipType")
49
@Entity
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){
108
			return null;  //better return null then initialize the termMap in an unwanted way 
109
		}
110
		return (SynonymRelationshipType)termMap.get(uuid);
111
	}
112
	
113
	/**
114
	 * Returns the synonym relationship type "is synonym of". This indicates
115
	 * that the reference asserting the {@link SynonymRelationship synonym relationship} does not know
116
	 * whether both {@link name.TaxonNameBase taxon names} involved are typified by the same type or
117
	 * not.
118
	 * 
119
	 * @see		#HOMOTYPIC_SYNONYM_OF()
120
	 * @see		#HETEROTYPIC_SYNONYM_OF()
121
	 */
122
	public static final SynonymRelationshipType SYNONYM_OF(){
123
		return getTermByUuid(uuidSynonymOf);
124
	}
125

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

    
141
	/**
142
	 * Returns the synonym relationship type "is heterotypic synonym of"
143
	 * ("is taxonomic synonym of" in zoology). This indicates that the
144
	 * the reference asserting the {@link SynonymRelationship synonym relationship} holds that
145
	 * the {@link name.TaxonNameBase taxon name} used as a {@link Synonym synonym} and the taxon name used as the
146
	 * ("accepted/correct") {@link Taxon taxon} are not typified by the same type.
147
	 * In this case they should not belong to the same {@link name.HomotypicalGroup homotypical group}.
148
	 * 
149
	 * @see		#HOMOTYPIC_SYNONYM_OF()
150
	 * @see		#SYNONYM_OF()
151
	 */
152
	public static final SynonymRelationshipType HETEROTYPIC_SYNONYM_OF(){
153
		return getTermByUuid(uuidHeterotypicSynonymOf);
154
	}
155
	
156
	/**
157
	 * Returns the synonym relationship type "is inferred synonym of".
158
	 * This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
159
	 * level is derived from a genus synonymy.
160
	 */
161
	public static final SynonymRelationshipType INFERRED_SYNONYM_OF(){
162
		return getTermByUuid(uuidInferredSynonymOf);
163
	}
164
	
165
	/**
166
	 * Returns the synonym relationship type "is inferred genus of".
167
	 * This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
168
	 * level is derived from a epithet synonymy.
169
	 */
170
	public static final SynonymRelationshipType INFERRED_GENUS_OF(){
171
		return getTermByUuid(uuidInferredGenusOf);
172
	}
173
	
174
	/**
175
	 * Returns the synonym relationship type "is inferred synonym of".
176
	 * This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
177
	 * level is derived from a genus synonymy.
178
	 */
179
	public static final SynonymRelationshipType INFERRED_EPITHET_OF(){
180
		return getTermByUuid(uuidInferredEpithetOf);
181
	}
182
	
183
	public static SynonymRelationshipType POTENTIAL_COMBINATION_OF() {
184
		return getTermByUuid(uuidPotentialCombinationOf);
185
	}
186
	
187

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

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

    
201
	
202

    
203
}
(8-8/18)