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
;
14 import java
.util
.UUID
;
16 import javax
.persistence
.Entity
;
17 import javax
.xml
.bind
.annotation
.XmlAccessType
;
18 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
19 import javax
.xml
.bind
.annotation
.XmlRootElement
;
20 import javax
.xml
.bind
.annotation
.XmlType
;
22 import org
.apache
.log4j
.Logger
;
23 import org
.hibernate
.envers
.Audited
;
24 import org
.hibernate
.search
.annotations
.Indexed
;
26 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
27 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipTermBase
;
28 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
29 import eu
.etaxonomy
.cdm
.model
.common
.TermVocabulary
;
32 * The class representing the categories of {@link HybridRelationship hybrid relationships}
33 * between a {@link BotanicalName botanical taxon name} used as a parent of a hybrid taxon
34 * name and the hybrid taxon name itself. Hybrids and their parents are always
35 * plants. The relationships are to be understood as 'is .... of'.
37 * A standard (ordered) list of hybrid relationship type instances will be
38 * automatically created as the project starts. But this class allows to extend
39 * this standard list by creating new instances of additional hybrid
40 * relationship types if needed. Hybrid relationship types are neither symmetric
44 * This class corresponds partially to: <ul>
45 * <li> TaxonRelationshipTerm according to the TDWG ontology
46 * <li> RelationshipType according to the TCS
51 * @created 08-Nov-2007 13:06:27
53 @XmlAccessorType(XmlAccessType
.FIELD
)
54 @XmlType(name
= "HybridRelationshipType")
55 @XmlRootElement(name
= "HybridRelationshipType")
57 @Indexed(index
= "eu.etaxonomy.cdm.model.common.DefinedTermBase")
59 public class HybridRelationshipType
extends RelationshipTermBase
<HybridRelationshipType
> {
60 private static final long serialVersionUID
= 5225908742890437668L;
61 @SuppressWarnings("unused")
62 private static final Logger logger
= Logger
.getLogger(HybridRelationshipType
.class);
64 protected static Map
<UUID
, HybridRelationshipType
> termMap
= null;
66 private static final UUID uuidFirstParent
= UUID
.fromString("83ae9e56-18f2-46b6-b211-45cdee775bf3");
67 private static final UUID uuidSecondParent
= UUID
.fromString("0485fc3d-4755-4f53-8832-b82774484c43");
68 private static final UUID uuidThirdParent
= UUID
.fromString("bfae2780-92ab-4f65-b534-e68826f59e7d");
69 private static final UUID uuidFourthParent
= UUID
.fromString("9e92083b-cb9b-4c4d-bca5-c543bbefd3c7");
70 private static final UUID uuidFemaleParent
= UUID
.fromString("189a3ed9-6860-4943-8be8-a1f60133be2a");
71 private static final UUID uuidMaleParent
= UUID
.fromString("8b7324c5-cc6c-4109-b708-d49b187815c4");
72 private static final UUID uuidMajorParent
= UUID
.fromString("da759eea-e3cb-4d3c-ae75-084c2d08f4ed");
73 private static final UUID uuidMinorParent
= UUID
.fromString("e556b240-b03f-46b8-839b-ad89df633c5a");
76 public static HybridRelationshipType
NewInstance(String term
, String label
, String labelAbbrev
) {
77 return new HybridRelationshipType(term
, label
, labelAbbrev
);
80 //********************************** Constructor *********************************/
82 //for hibernate use only
84 protected HybridRelationshipType() {
85 super(TermType
.HybridRelationshipType
);
88 * Class constructor: creates an additional hybrid relationship type
89 * instance with a description (in the {@link Language#DEFAULT() default language}), a label,
90 * a label abbreviation and the flags indicating whether this new hybrid
91 * relationship type is symmetric and/or transitive.
93 * @param term the string (in the default language) describing the
94 * new hybrid relationship type to be created
95 * @param label the string identifying the new hybrid relationship
97 * @param labelAbbrev the string identifying (in abbreviated form) the
98 * new hybrid relationship type to be created
99 * @see #HybridRelationshipType()
101 private HybridRelationshipType(String term
, String label
, String labelAbbrev
) {
102 super(TermType
.HybridRelationshipType
, term
, label
, labelAbbrev
, false, false);
106 //************************** METHODS ********************************
109 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
112 public void resetTerms(){
117 protected static HybridRelationshipType
getTermByUuid(UUID uuid
){
118 if (termMap
== null){
119 return null; //better return null then initialize the termMap in an unwanted way
121 return (HybridRelationshipType
)termMap
.get(uuid
);
125 * Returns the "first parent" hybrid relationship type. The elements of the
126 * {@link NonViralName non-viral taxon name} used as "first parent" affect the
127 * taxon name string of the hybrid (see Appendix I of the ICBN).
129 * @see #SECOND_PARENT()
130 * @see #THIRD_PARENT()
131 * @see #FOURTH_PARENT()
132 * @see #FEMALE_PARENT()
133 * @see #MAJOR_PARENT()
135 public static final HybridRelationshipType
FIRST_PARENT(){
136 return getTermByUuid(uuidFirstParent
);
140 * Returns the "second parent" hybrid relationship type. The elements of the
141 * {@link NonViralName non-viral taxon name} used as "second parent" affect the
142 * taxon name string of the hybrid (see Appendix I of the ICBN).
144 * @see #FIRST_PARENT()
145 * @see #MALE_PARENT()
146 * @see #MINOR_PARENT()
148 public static final HybridRelationshipType
SECOND_PARENT(){
149 return getTermByUuid(uuidSecondParent
);
153 * Returns the "third parent" hybrid relationship type. The elements of the
154 * {@link NonViralName non viral taxon name} used as "third parent" affect the
155 * taxon name string of the hybrid (see Appendix I of the ICBN).
157 * @see #FIRST_PARENT()
159 public static final HybridRelationshipType
THIRD_PARENT(){
160 return getTermByUuid(uuidThirdParent
);
164 * Returns the "fourth parent" hybrid relationship type. The elements of the
165 * {@link NonViralName non viral taxon name} used as "third parent" affect the
166 * taxon name string of the hybrid (see Appendix I of the ICBN).
168 * @see #FIRST_PARENT()
170 public static final HybridRelationshipType
FOURTH_PARENT(){
171 return getTermByUuid(uuidFourthParent
);
175 * Returns the "female parent" hybrid relationship type. The taxon the name
176 * of which plays the female parent role is the genetic mother of the taxon
177 * which is the hybrid (and has the hybrid {@link NonViralName non-viral taxon name})<BR>
178 * For nomenclature purposes a "female parent" is also a "first parent".
180 * @see #MALE_PARENT()
181 * @see #FIRST_PARENT()
183 public static final HybridRelationshipType
FEMALE_PARENT(){
184 return getTermByUuid(uuidFemaleParent
);
188 * Returns the "male parent" hybrid relationship type. The taxon the name
189 * of which plays the male parent role is the genetic father of the taxon
190 * which is the hybrid (and has the hybrid {@link NonViralName non-viral taxon name}).<BR>
191 * For nomenclature purposes a "male parent" is also a "second parent".
193 * @see #MALE_PARENT()
194 * @see #SECOND_PARENT()
196 public static final HybridRelationshipType
MALE_PARENT(){
197 return getTermByUuid(uuidMaleParent
);
201 * Returns the "major parent" hybrid relationship type. This relationship
202 * maybe used for hybrids which have parents that are not equally represented
203 * in the child (e.g. some fern hybrids).
204 * For nomenclature purposes a "major parent" is also a "first parent".<BR>
205 * Major and minor parent relationships are usually represented in a
206 * hybrid formula with a "greater than" symbol (>). It replaces the multiplication
207 * symbol which is generally used for hybrid fromulas.
209 * @see #FIRST_PARENT()
210 * @see #MINOR_PARENT()
212 public static final HybridRelationshipType
MAJOR_PARENT(){
213 return getTermByUuid(uuidMajorParent
);
217 * Returns the "minor parent" hybrid relationship type. This relationship
218 * maybe used for hybrids which have parents that are not equally represented
219 * in the child (e.g. some fern hybrids).<BR>
220 * For nomenclature purposes a "major parent" is also a "second parent".
221 * Major and minor parent relationships are usually represented in a
222 * hybrid formula with a "greater than" symbol (>). It replaces the multiplication
223 * symbol which is generally used for hybrid fromulas.
225 * @see #SECOND_PARENT()
227 public static final HybridRelationshipType
MINOR_PARENT(){
228 return getTermByUuid(uuidMinorParent
);
233 public int compareTo(HybridRelationshipType otherRelationshipType
) {
234 return super.performCompareTo(otherRelationshipType
, true);
238 protected void setDefaultTerms(TermVocabulary
<HybridRelationshipType
> termVocabulary
) {
239 termMap
= new HashMap
<UUID
, HybridRelationshipType
>();
240 for (HybridRelationshipType term
: termVocabulary
.getTerms()){
241 termMap
.put(term
.getUuid(), (HybridRelationshipType
)term
);
246 // public HybridRelationshipType readCsvLine(Class<HybridRelationshipType> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms) {
247 // return super.readCsvLine(termClass, csvLine, terms);