2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.name
;
12 import java
.util
.HashMap
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
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
.XmlRootElement
;
21 import javax
.xml
.bind
.annotation
.XmlType
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.envers
.Audited
;
25 import org
.hibernate
.search
.annotations
.Indexed
;
27 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTermBase
;
28 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
29 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipTermBase
;
30 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
33 * The class representing the categories of {@link HybridRelationship hybrid relationships}
34 * between a {@link BotanicalName botanical taxon name} used as a parent of a hybrid taxon
35 * name and the hybrid taxon name itself. Hybrids and their parents are always
36 * plants. The relationships are to be understood as 'is .... of'.
38 * A standard (ordered) list of hybrid relationship type instances will be
39 * automatically created as the project starts. But this class allows to extend
40 * this standard list by creating new instances of additional hybrid
41 * relationship types if needed. Hybrid relationship types are neither symmetric
45 * This class corresponds partially to: <ul>
46 * <li> TaxonRelationshipTerm according to the TDWG ontology
47 * <li> RelationshipType according to the TCS
52 * @created 08-Nov-2007 13:06:27
54 @XmlAccessorType(XmlAccessType
.FIELD
)
55 @XmlType(name
= "HybridRelationshipType")
56 @XmlRootElement(name
= "HybridRelationshipType")
58 @Indexed(index
= "eu.etaxonomy.cdm.model.common.DefinedTermBase")
60 public class HybridRelationshipType
extends RelationshipTermBase
<HybridRelationshipType
> {
61 private static final long serialVersionUID
= 5225908742890437668L;
62 @SuppressWarnings("unused")
63 private static final Logger logger
= Logger
.getLogger(HybridRelationshipType
.class);
65 protected static Map
<UUID
, HybridRelationshipType
> termMap
= null;
67 private static final UUID uuidFirstParent
= UUID
.fromString("83ae9e56-18f2-46b6-b211-45cdee775bf3");
68 private static final UUID uuidSecondParent
= UUID
.fromString("0485fc3d-4755-4f53-8832-b82774484c43");
69 private static final UUID uuidThirdParent
= UUID
.fromString("bfae2780-92ab-4f65-b534-e68826f59e7d");
70 private static final UUID uuidFourthParent
= UUID
.fromString("9e92083b-cb9b-4c4d-bca5-c543bbefd3c7");
71 private static final UUID uuidFemaleParent
= UUID
.fromString("189a3ed9-6860-4943-8be8-a1f60133be2a");
72 private static final UUID uuidMaleParent
= UUID
.fromString("8b7324c5-cc6c-4109-b708-d49b187815c4");
73 private static final UUID uuidMajorParent
= UUID
.fromString("da759eea-e3cb-4d3c-ae75-084c2d08f4ed");
74 private static final UUID uuidMinorParent
= UUID
.fromString("e556b240-b03f-46b8-839b-ad89df633c5a");
77 // ************* CONSTRUCTORS *************/
79 * Class constructor: creates a new empty hybrid relationship type instance.
81 * @see #HybridRelationshipType(String, String, String)
83 public HybridRelationshipType() {
86 * Class constructor: creates an additional hybrid relationship type
87 * instance with a description (in the {@link Language#DEFAULT() default language}), a label,
88 * a label abbreviation and the flags indicating whether this new hybrid
89 * relationship type is symmetric and/or transitive.
91 * @param term the string (in the default language) describing the
92 * new hybrid relationship type to be created
93 * @param label the string identifying the new hybrid relationship
95 * @param labelAbbrev the string identifying (in abbreviated form) the
96 * new hybrid relationship type to be created
97 * @see #HybridRelationshipType()
99 public HybridRelationshipType(String term
, String label
, String labelAbbrev
) {
100 super(term
, label
, labelAbbrev
, false, false);
104 //************************** METHODS ********************************
107 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
110 public void resetTerms(){
115 protected static HybridRelationshipType
getTermByUuid(UUID uuid
){
116 if (termMap
== null){
117 return null; //better return null then initialize the termMap in an unwanted way
119 return (HybridRelationshipType
)termMap
.get(uuid
);
123 * Returns the "first parent" hybrid relationship type. The elements of the
124 * {@link NonViralName non-viral taxon name} used as "first parent" affect the
125 * taxon name string of the hybrid (see Appendix I of the ICBN).
127 * @see #SECOND_PARENT()
128 * @see #THIRD_PARENT()
129 * @see #FOURTH_PARENT()
130 * @see #FEMALE_PARENT()
131 * @see #MAJOR_PARENT()
133 public static final HybridRelationshipType
FIRST_PARENT(){
134 return getTermByUuid(uuidFirstParent
);
138 * Returns the "second parent" hybrid relationship type. The elements of the
139 * {@link NonViralName non-viral taxon name} used as "second parent" affect the
140 * taxon name string of the hybrid (see Appendix I of the ICBN).
142 * @see #FIRST_PARENT()
143 * @see #MALE_PARENT()
144 * @see #MINOR_PARENT()
146 public static final HybridRelationshipType
SECOND_PARENT(){
147 return getTermByUuid(uuidSecondParent
);
151 * Returns the "third parent" hybrid relationship type. The elements of the
152 * {@link NonViralName non viral taxon name} used as "third parent" affect the
153 * taxon name string of the hybrid (see Appendix I of the ICBN).
155 * @see #FIRST_PARENT()
157 public static final HybridRelationshipType
THIRD_PARENT(){
158 return getTermByUuid(uuidThirdParent
);
162 * Returns the "fourth parent" hybrid relationship type. The elements of the
163 * {@link NonViralName non viral taxon name} used as "third parent" affect the
164 * taxon name string of the hybrid (see Appendix I of the ICBN).
166 * @see #FIRST_PARENT()
168 public static final HybridRelationshipType
FOURTH_PARENT(){
169 return getTermByUuid(uuidFourthParent
);
173 * Returns the "female parent" hybrid relationship type. The taxon the name
174 * of which plays the female parent role is the genetic mother of the taxon
175 * which is the hybrid (and has the hybrid {@link NonViralName non-viral taxon name})<BR>
176 * For nomenclature purposes a "female parent" is also a "first parent".
178 * @see #MALE_PARENT()
179 * @see #FIRST_PARENT()
181 public static final HybridRelationshipType
FEMALE_PARENT(){
182 return getTermByUuid(uuidFemaleParent
);
186 * Returns the "male parent" hybrid relationship type. The taxon the name
187 * of which plays the male parent role is the genetic father of the taxon
188 * which is the hybrid (and has the hybrid {@link NonViralName non-viral taxon name}).<BR>
189 * For nomenclature purposes a "male parent" is also a "second parent".
191 * @see #MALE_PARENT()
192 * @see #SECOND_PARENT()
194 public static final HybridRelationshipType
MALE_PARENT(){
195 return getTermByUuid(uuidMaleParent
);
199 * Returns the "major parent" hybrid relationship type. This relationship
200 * maybe used for hybrids which have parents that are not equally represented
201 * in the child (e.g. some fern hybrids).
202 * For nomenclature purposes a "major parent" is also a "first parent".<BR>
203 * Major and minor parent relationships are usually represented in a
204 * hybrid formula with a "greater than" symbol (>). It replaces the multiplication
205 * symbol which is generally used for hybrid fromulas.
207 * @see #FIRST_PARENT()
208 * @see #MINOR_PARENT()
210 public static final HybridRelationshipType
MAJOR_PARENT(){
211 return getTermByUuid(uuidMajorParent
);
215 * Returns the "minor parent" hybrid relationship type. This relationship
216 * maybe used for hybrids which have parents that are not equally represented
217 * in the child (e.g. some fern hybrids).<BR>
218 * For nomenclature purposes a "major parent" is also a "second parent".
219 * Major and minor parent relationships are usually represented in a
220 * hybrid formula with a "greater than" symbol (>). It replaces the multiplication
221 * symbol which is generally used for hybrid fromulas.
223 * @see #SECOND_PARENT()
225 public static final HybridRelationshipType
MINOR_PARENT(){
226 return getTermByUuid(uuidMinorParent
);
231 public int compareTo(HybridRelationshipType otherRelationshipType
) {
232 return super.performCompareTo(otherRelationshipType
, true);
236 protected void setDefaultTerms(TermVocabulary
<HybridRelationshipType
> termVocabulary
) {
237 termMap
= new HashMap
<UUID
, HybridRelationshipType
>();
238 for (HybridRelationshipType term
: termVocabulary
.getTerms()){
239 termMap
.put(term
.getUuid(), (HybridRelationshipType
)term
);
244 public HybridRelationshipType
readCsvLine(Class
<HybridRelationshipType
> termClass
, List
<String
> csvLine
, Map
<UUID
,DefinedTermBase
> terms
) {
245 return super.readCsvLine(termClass
, csvLine
, terms
);