Revision af45e069
Added by Andreas Müller almost 8 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/DescriptionBase.java | ||
---|---|---|
90 | 90 |
@ManyToOne(fetch = FetchType.LAZY) |
91 | 91 |
@XmlIDREF |
92 | 92 |
@XmlSchemaType(name="IDREF") |
93 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
93 |
@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE})
|
|
94 | 94 |
@JoinColumn(name="specimen_id") |
95 | 95 |
@FieldBridge(impl=NotNullAwareIdBridge.class) |
96 | 96 |
//TODO maybe move down to specific classes SpecimenDescription (with Cascade.Delete) and TaxonDescription (without Cascade) |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/FeatureTree.java | ||
---|---|---|
159 | 159 |
|
160 | 160 |
// ****************** GETTER / SETTER **********************************/ |
161 | 161 |
|
162 |
|
|
163 |
// @OneToMany |
|
164 |
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
165 |
// public Set<FeatureNode> getNodes() { |
|
166 |
// return nodes; |
|
167 |
// } |
|
168 |
// public void setNodes(Set<FeatureNode> nodes) { |
|
169 |
// this.nodes = nodes; |
|
170 |
// } |
|
171 |
|
|
172 | 162 |
/** |
173 | 163 |
* Returns the topmost {@link FeatureNode feature node} (root node) of <i>this</i> |
174 | 164 |
* feature tree. The root node does not have any parent. Since feature nodes |
... | ... | |
222 | 212 |
* @see java.lang.Object#clone() |
223 | 213 |
*/ |
224 | 214 |
@Override |
225 |
|
|
226 | 215 |
public Object clone() { |
227 | 216 |
FeatureTree result; |
228 | 217 |
try { |
... | ... | |
238 | 227 |
return result; |
239 | 228 |
|
240 | 229 |
} |
241 |
|
|
242 |
|
|
243 | 230 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TypeDesignationBase.java | ||
---|---|---|
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.name; |
|
11 |
|
|
12 |
import java.util.HashSet; |
|
13 |
import java.util.Set; |
|
14 |
|
|
15 |
import javax.persistence.Entity; |
|
16 |
import javax.persistence.FetchType; |
|
17 |
import javax.persistence.Inheritance; |
|
18 |
import javax.persistence.InheritanceType; |
|
19 |
import javax.persistence.ManyToMany; |
|
20 |
import javax.persistence.ManyToOne; |
|
21 |
import javax.xml.bind.annotation.XmlElement; |
|
22 |
import javax.xml.bind.annotation.XmlElementWrapper; |
|
23 |
import javax.xml.bind.annotation.XmlIDREF; |
|
24 |
import javax.xml.bind.annotation.XmlRootElement; |
|
25 |
import javax.xml.bind.annotation.XmlSchemaType; |
|
26 |
import javax.xml.bind.annotation.XmlSeeAlso; |
|
27 |
import javax.xml.bind.annotation.XmlType; |
|
28 |
|
|
29 |
import org.apache.log4j.Logger; |
|
30 |
import org.hibernate.annotations.Cascade; |
|
31 |
import org.hibernate.annotations.CascadeType; |
|
32 |
import org.hibernate.envers.Audited; |
|
33 |
|
|
34 |
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase; |
|
35 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
36 |
import eu.etaxonomy.cdm.validation.Level2; |
|
37 |
import eu.etaxonomy.cdm.validation.annotation.ValidTypeDesignation; |
|
38 |
|
|
39 |
/** |
|
40 |
* The (abstract) class representing a typification of one or several {@link TaxonNameBase taxon names}.<BR> |
|
41 |
* All taxon names which have a {@link Rank rank} "species aggregate" or lower |
|
42 |
* can only be typified by specimens (a {@link SpecimenTypeDesignation specimen type designation}), but taxon |
|
43 |
* names with a higher rank might be typified by an other taxon name with |
|
44 |
* rank "species" or "genus" (a {@link NameTypeDesignation name type designation}). |
|
45 |
* |
|
46 |
* @see TaxonNameBase |
|
47 |
* @see NameTypeDesignation |
|
48 |
* @see SpecimenTypeDesignation |
|
49 |
* @author a.mueller |
|
50 |
* @created 07.08.2008 |
|
51 |
* @version 1.0 |
|
52 |
*/ |
|
53 |
@XmlRootElement(name = "TypeDesignationBase") |
|
54 |
@XmlType(name = "TypeDesignationBase", propOrder = { |
|
55 |
"typifiedNames", |
|
56 |
"notDesignated", |
|
57 |
"typeStatus" |
|
58 |
}) |
|
59 |
@XmlSeeAlso({ |
|
60 |
NameTypeDesignation.class, |
|
61 |
SpecimenTypeDesignation.class |
|
62 |
}) |
|
63 |
@Entity |
|
64 |
@Audited |
|
65 |
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) |
|
66 |
@ValidTypeDesignation(groups=Level2.class) |
|
67 |
public abstract class TypeDesignationBase<T extends TypeDesignationStatusBase> extends ReferencedEntityBase implements ITypeDesignation { |
|
68 |
private static final long serialVersionUID = 8622351017235131355L; |
|
69 |
|
|
70 |
@SuppressWarnings("unused") |
|
71 |
private static final Logger logger = Logger.getLogger(TypeDesignationBase.class); |
|
72 |
|
|
73 |
@XmlElement(name = "IsNotDesignated") |
|
74 |
private boolean notDesignated; |
|
75 |
|
|
76 |
@XmlElementWrapper(name = "TypifiedNames") |
|
77 |
@XmlElement(name = "TypifiedName") |
|
78 |
@XmlIDREF |
|
79 |
@XmlSchemaType(name = "IDREF") |
|
80 |
@ManyToMany(fetch = FetchType.LAZY , mappedBy="typeDesignations") |
|
81 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
82 |
private Set<TaxonNameBase> typifiedNames = new HashSet<TaxonNameBase>(); |
|
83 |
|
|
84 |
// @XmlElement(name = "HomotypicalGroup") |
|
85 |
// @XmlIDREF |
|
86 |
// @XmlSchemaType(name = "IDREF") |
|
87 |
// @ManyToOne(fetch = FetchType.LAZY) |
|
88 |
// @Cascade(CascadeType.SAVE_UPDATE,CascadeType.MERGE) |
|
89 |
// private HomotypicalGroup homotypicalGroup; |
|
90 |
|
|
91 |
@XmlElement(name = "TypeStatus") |
|
92 |
@XmlIDREF |
|
93 |
@XmlSchemaType(name = "IDREF") |
|
94 |
@ManyToOne(fetch = FetchType.LAZY, targetEntity = TypeDesignationStatusBase.class) |
|
95 |
private T typeStatus; |
|
96 |
|
|
97 |
// **************** CONSTRUCTOR *************************************/ |
|
98 |
|
|
99 |
/** |
|
100 |
* Class constructor: creates a new empty type designation. |
|
101 |
* |
|
102 |
* @see #TypeDesignationBase(Reference, String, String, Boolean) |
|
103 |
*/ |
|
104 |
protected TypeDesignationBase(){ |
|
105 |
super(); |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* Class constructor: creates a new type designation |
|
110 |
* (including its {@link Reference reference source} and eventually |
|
111 |
* the taxon name string originally used by this reference when establishing |
|
112 |
* the former designation). |
|
113 |
* |
|
114 |
* @param citation the reference source for the new designation |
|
115 |
* @param citationMicroReference the string with the details describing the exact localisation within the reference |
|
116 |
* @param originalNameString the taxon name string used originally in the reference source for the new designation |
|
117 |
* @see #TypeDesignationBase() |
|
118 |
* @see #isNotDesignated() |
|
119 |
* @see TaxonNameBase#getTypeDesignations() |
|
120 |
*/ |
|
121 |
protected TypeDesignationBase(Reference citation, String citationMicroReference, String originalNameString) { |
|
122 |
this(citation, citationMicroReference, originalNameString, false); |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* Class constructor: creates a new type designation |
|
127 |
* (including its {@link Reference reference source} and eventually |
|
128 |
* the taxon name string originally used by this reference when establishing |
|
129 |
* the former designation). |
|
130 |
* |
|
131 |
* @param citation the reference source for the new designation |
|
132 |
* @param citationMicroReference the string with the details describing the exact localisation within the reference |
|
133 |
* @param originalNameString the taxon name string used originally in the reference source for the new designation |
|
134 |
* @param isNotDesignated the boolean flag indicating whether there is no type at all for |
|
135 |
* <i>this</i> type designation |
|
136 |
* @see #TypeDesignationBase() |
|
137 |
* @see #isNotDesignated() |
|
138 |
* @see TaxonNameBase#getTypeDesignations() |
|
139 |
*/ |
|
140 |
protected TypeDesignationBase(Reference citation, String citationMicroReference, String originalNameString, boolean notDesignated){ |
|
141 |
super(citation, citationMicroReference, originalNameString); |
|
142 |
this.notDesignated = notDesignated; |
|
143 |
} |
|
144 |
|
|
145 |
|
|
146 |
// **************** METHODS *************************************/ |
|
147 |
|
|
148 |
|
|
149 |
/** |
|
150 |
* Returns the {@link TypeDesignationStatusBase type designation status} for <i>this</i> specimen type |
|
151 |
* designation. This status describes which of the possible categories of |
|
152 |
* types like "holotype", "neotype", "syntype" or "isotype" applies to <i>this</i> |
|
153 |
* specimen type designation. |
|
154 |
*/ |
|
155 |
public T getTypeStatus(){ |
|
156 |
return this.typeStatus; |
|
157 |
} |
|
158 |
/** |
|
159 |
* @see #getTypeStatus() |
|
160 |
*/ |
|
161 |
public void setTypeStatus(T typeStatus){ |
|
162 |
this.typeStatus = typeStatus; |
|
163 |
} |
|
164 |
|
|
165 |
// /* (non-Javadoc) |
|
166 |
// * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getHomotypicalGroup() |
|
167 |
// */ |
|
168 |
// /** |
|
169 |
// * Returns the {@link HomotypicalGroup homotypical group} to which all (in <i>this</i> |
|
170 |
// * type designation) typified {@link TaxonNameBase taxon names} belong. |
|
171 |
// * |
|
172 |
// * @see #getTypifiedNames() |
|
173 |
// * @deprecated homotypical group can not be set and always seems to be <code>null</code>. |
|
174 |
// * Probably it is a relict of an old version. |
|
175 |
// * See also http://dev.e-taxonomy.eu/trac/ticket/2173 |
|
176 |
// */ |
|
177 |
// @Deprecated |
|
178 |
// public HomotypicalGroup getHomotypicalGroup() { |
|
179 |
// return homotypicalGroup; |
|
180 |
// } |
|
181 |
|
|
182 |
/* (non-Javadoc) |
|
183 |
* @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getTypifiedNames() |
|
184 |
*/ |
|
185 |
/** |
|
186 |
* Returns the set of {@link TaxonNameBase taxon names} typified in <i>this</i> |
|
187 |
* type designation. This is a subset of the taxon names belonging to the |
|
188 |
* corresponding {@link #getHomotypicalGroup() homotypical group}. |
|
189 |
*/ |
|
190 |
@Override |
|
191 |
public Set<TaxonNameBase> getTypifiedNames() { |
|
192 |
return typifiedNames; |
|
193 |
} |
|
194 |
|
|
195 |
/** |
|
196 |
* Returns the boolean value "true" if it is known that a type does not |
|
197 |
* exist and therefore the {@link TaxonNameBase taxon name} to which <i>this</i> |
|
198 |
* type designation is assigned must still be typified. Two |
|
199 |
* cases must be differentiated: <BR><ul> |
|
200 |
* <li> a) it is unknown whether a type exists and |
|
201 |
* <li> b) it is known that no type exists |
|
202 |
* </ul> |
|
203 |
* If a) is true there should be no TypeDesignation instance at all |
|
204 |
* assigned to the "typified" taxon name.<BR> |
|
205 |
* If b) is true there should be a TypeDesignation instance with the |
|
206 |
* flag isNotDesignated set. The typeName attribute, in case of a |
|
207 |
* {@link NameTypeDesignation name type designation}, or the typeSpecimen attribute, |
|
208 |
* in case of a {@link SpecimenTypeDesignation specimen type designation}, should then be "null". |
|
209 |
*/ |
|
210 |
public boolean isNotDesignated() { |
|
211 |
return notDesignated; |
|
212 |
} |
|
213 |
|
|
214 |
/** |
|
215 |
* @see #isNotDesignated() |
|
216 |
*/ |
|
217 |
public void setNotDesignated(boolean notDesignated) { |
|
218 |
this.notDesignated = notDesignated; |
|
219 |
} |
|
220 |
|
|
221 |
/** |
|
222 |
* @deprecated for bidirectional use only |
|
223 |
*/ |
|
224 |
@Deprecated |
|
225 |
protected void addTypifiedName(TaxonNameBase taxonName){ |
|
226 |
this.typifiedNames.add(taxonName); |
|
227 |
} |
|
228 |
|
|
229 |
/** |
|
230 |
* @deprecated for bidirectional use only |
|
231 |
*/ |
|
232 |
@Deprecated |
|
233 |
protected void removeTypifiedName(TaxonNameBase taxonName){ |
|
234 |
this.typifiedNames.remove(taxonName); |
|
235 |
if (taxonName.getTypeDesignations().contains(this)){ |
|
236 |
taxonName.removeTypeDesignation(this); |
|
237 |
} |
|
238 |
} |
|
239 |
|
|
240 |
public abstract void removeType(); |
|
241 |
|
|
242 |
//*********************** CLONE ********************************************************/ |
|
243 |
|
|
244 |
/** |
|
245 |
* Clones <i>this</i> type designation. This is a shortcut that enables to create |
|
246 |
* a new instance that differs only slightly from <i>this</i> type designation by |
|
247 |
* modifying only some of the attributes.<BR> |
|
248 |
* CAUTION: the typifiedNames set is not cloned but empty after cloning as the typified |
|
249 |
* names is considered to be the not owning part of a bidirectional relationship. |
|
250 |
* This may be changed in future. |
|
251 |
* |
|
252 |
* @throws CloneNotSupportedException |
|
253 |
* |
|
254 |
* @see eu.etaxonomy.cdm.model.common.ReferencedEntityBase#clone() |
|
255 |
* @see java.lang.Object#clone() |
|
256 |
*/ |
|
257 |
@Override |
|
258 |
public Object clone() throws CloneNotSupportedException { |
|
259 |
TypeDesignationBase result = (TypeDesignationBase)super.clone(); |
|
260 |
|
|
261 |
result.typifiedNames = new HashSet<TaxonNameBase>(); |
|
262 |
// for (TaxonNameBase taxonNameBase : getTypifiedNames()){ |
|
263 |
// result.typifiedNames.add(taxonNameBase); |
|
264 |
// } |
|
265 |
|
|
266 |
|
|
267 |
//no changes to: notDesignated, typeStatus, homotypicalGroup |
|
268 |
return result; |
|
269 |
} |
|
270 |
} |
|
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.name; |
|
11 |
|
|
12 |
import java.util.HashSet; |
|
13 |
import java.util.Set; |
|
14 |
|
|
15 |
import javax.persistence.Entity; |
|
16 |
import javax.persistence.FetchType; |
|
17 |
import javax.persistence.Inheritance; |
|
18 |
import javax.persistence.InheritanceType; |
|
19 |
import javax.persistence.ManyToMany; |
|
20 |
import javax.persistence.ManyToOne; |
|
21 |
import javax.xml.bind.annotation.XmlElement; |
|
22 |
import javax.xml.bind.annotation.XmlElementWrapper; |
|
23 |
import javax.xml.bind.annotation.XmlIDREF; |
|
24 |
import javax.xml.bind.annotation.XmlRootElement; |
|
25 |
import javax.xml.bind.annotation.XmlSchemaType; |
|
26 |
import javax.xml.bind.annotation.XmlSeeAlso; |
|
27 |
import javax.xml.bind.annotation.XmlType; |
|
28 |
|
|
29 |
import org.apache.log4j.Logger; |
|
30 |
import org.hibernate.annotations.Cascade; |
|
31 |
import org.hibernate.annotations.CascadeType; |
|
32 |
import org.hibernate.envers.Audited; |
|
33 |
|
|
34 |
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase; |
|
35 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
36 |
import eu.etaxonomy.cdm.validation.Level2; |
|
37 |
import eu.etaxonomy.cdm.validation.annotation.ValidTypeDesignation; |
|
38 |
|
|
39 |
/** |
|
40 |
* The (abstract) class representing a typification of one or several {@link TaxonNameBase taxon names}.<BR> |
|
41 |
* All taxon names which have a {@link Rank rank} "species aggregate" or lower |
|
42 |
* can only be typified by specimens (a {@link SpecimenTypeDesignation specimen type designation}), but taxon |
|
43 |
* names with a higher rank might be typified by an other taxon name with |
|
44 |
* rank "species" or "genus" (a {@link NameTypeDesignation name type designation}). |
|
45 |
* |
|
46 |
* @see TaxonNameBase |
|
47 |
* @see NameTypeDesignation |
|
48 |
* @see SpecimenTypeDesignation |
|
49 |
* @author a.mueller |
|
50 |
* @created 07.08.2008 |
|
51 |
* @version 1.0 |
|
52 |
*/ |
|
53 |
@XmlRootElement(name = "TypeDesignationBase") |
|
54 |
@XmlType(name = "TypeDesignationBase", propOrder = { |
|
55 |
"typifiedNames", |
|
56 |
"notDesignated", |
|
57 |
"typeStatus" |
|
58 |
}) |
|
59 |
@XmlSeeAlso({ |
|
60 |
NameTypeDesignation.class, |
|
61 |
SpecimenTypeDesignation.class |
|
62 |
}) |
|
63 |
@Entity |
|
64 |
@Audited |
|
65 |
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) |
|
66 |
@ValidTypeDesignation(groups=Level2.class) |
|
67 |
public abstract class TypeDesignationBase<T extends TypeDesignationStatusBase> extends ReferencedEntityBase implements ITypeDesignation { |
|
68 |
private static final long serialVersionUID = 8622351017235131355L; |
|
69 |
|
|
70 |
@SuppressWarnings("unused") |
|
71 |
private static final Logger logger = Logger.getLogger(TypeDesignationBase.class); |
|
72 |
|
|
73 |
@XmlElement(name = "IsNotDesignated") |
|
74 |
private boolean notDesignated; |
|
75 |
|
|
76 |
@XmlElementWrapper(name = "TypifiedNames") |
|
77 |
@XmlElement(name = "TypifiedName") |
|
78 |
@XmlIDREF |
|
79 |
@XmlSchemaType(name = "IDREF") |
|
80 |
@ManyToMany(fetch = FetchType.LAZY , mappedBy="typeDesignations") |
|
81 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
82 |
private Set<TaxonNameBase> typifiedNames = new HashSet<TaxonNameBase>(); |
|
83 |
|
|
84 |
@XmlElement(name = "TypeStatus") |
|
85 |
@XmlIDREF |
|
86 |
@XmlSchemaType(name = "IDREF") |
|
87 |
@ManyToOne(fetch = FetchType.LAZY, targetEntity = TypeDesignationStatusBase.class) |
|
88 |
private T typeStatus; |
|
89 |
|
|
90 |
// **************** CONSTRUCTOR *************************************/ |
|
91 |
|
|
92 |
/** |
|
93 |
* Class constructor: creates a new empty type designation. |
|
94 |
* |
|
95 |
* @see #TypeDesignationBase(Reference, String, String, Boolean) |
|
96 |
*/ |
|
97 |
protected TypeDesignationBase(){ |
|
98 |
super(); |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* Class constructor: creates a new type designation |
|
103 |
* (including its {@link Reference reference source} and eventually |
|
104 |
* the taxon name string originally used by this reference when establishing |
|
105 |
* the former designation). |
|
106 |
* |
|
107 |
* @param citation the reference source for the new designation |
|
108 |
* @param citationMicroReference the string with the details describing the exact localisation within the reference |
|
109 |
* @param originalNameString the taxon name string used originally in the reference source for the new designation |
|
110 |
* @see #TypeDesignationBase() |
|
111 |
* @see #isNotDesignated() |
|
112 |
* @see TaxonNameBase#getTypeDesignations() |
|
113 |
*/ |
|
114 |
protected TypeDesignationBase(Reference citation, String citationMicroReference, String originalNameString) { |
|
115 |
this(citation, citationMicroReference, originalNameString, false); |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* Class constructor: creates a new type designation |
|
120 |
* (including its {@link Reference reference source} and eventually |
|
121 |
* the taxon name string originally used by this reference when establishing |
|
122 |
* the former designation). |
|
123 |
* |
|
124 |
* @param citation the reference source for the new designation |
|
125 |
* @param citationMicroReference the string with the details describing the exact localisation within the reference |
|
126 |
* @param originalNameString the taxon name string used originally in the reference source for the new designation |
|
127 |
* @param isNotDesignated the boolean flag indicating whether there is no type at all for |
|
128 |
* <i>this</i> type designation |
|
129 |
* @see #TypeDesignationBase() |
|
130 |
* @see #isNotDesignated() |
|
131 |
* @see TaxonNameBase#getTypeDesignations() |
|
132 |
*/ |
|
133 |
protected TypeDesignationBase(Reference citation, String citationMicroReference, String originalNameString, boolean notDesignated){ |
|
134 |
super(citation, citationMicroReference, originalNameString); |
|
135 |
this.notDesignated = notDesignated; |
|
136 |
} |
|
137 |
|
|
138 |
|
|
139 |
// **************** METHODS *************************************/ |
|
140 |
|
|
141 |
|
|
142 |
/** |
|
143 |
* Returns the {@link TypeDesignationStatusBase type designation status} for <i>this</i> specimen type |
|
144 |
* designation. This status describes which of the possible categories of |
|
145 |
* types like "holotype", "neotype", "syntype" or "isotype" applies to <i>this</i> |
|
146 |
* specimen type designation. |
|
147 |
*/ |
|
148 |
public T getTypeStatus(){ |
|
149 |
return this.typeStatus; |
|
150 |
} |
|
151 |
/** |
|
152 |
* @see #getTypeStatus() |
|
153 |
*/ |
|
154 |
public void setTypeStatus(T typeStatus){ |
|
155 |
this.typeStatus = typeStatus; |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Returns the set of {@link TaxonNameBase taxon names} typified in <i>this</i> |
|
160 |
* type designation. This is a subset of the taxon names belonging to the |
|
161 |
* corresponding {@link #getHomotypicalGroup() homotypical group}. |
|
162 |
*/ |
|
163 |
@Override |
|
164 |
public Set<TaxonNameBase> getTypifiedNames() { |
|
165 |
return typifiedNames; |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* Returns the boolean value "true" if it is known that a type does not |
|
170 |
* exist and therefore the {@link TaxonNameBase taxon name} to which <i>this</i> |
|
171 |
* type designation is assigned must still be typified. Two |
|
172 |
* cases must be differentiated: <BR><ul> |
|
173 |
* <li> a) it is unknown whether a type exists and |
|
174 |
* <li> b) it is known that no type exists |
|
175 |
* </ul> |
|
176 |
* If a) is true there should be no TypeDesignation instance at all |
|
177 |
* assigned to the "typified" taxon name.<BR> |
|
178 |
* If b) is true there should be a TypeDesignation instance with the |
|
179 |
* flag isNotDesignated set. The typeName attribute, in case of a |
|
180 |
* {@link NameTypeDesignation name type designation}, or the typeSpecimen attribute, |
|
181 |
* in case of a {@link SpecimenTypeDesignation specimen type designation}, should then be "null". |
|
182 |
*/ |
|
183 |
public boolean isNotDesignated() { |
|
184 |
return notDesignated; |
|
185 |
} |
|
186 |
|
|
187 |
/** |
|
188 |
* @see #isNotDesignated() |
|
189 |
*/ |
|
190 |
public void setNotDesignated(boolean notDesignated) { |
|
191 |
this.notDesignated = notDesignated; |
|
192 |
} |
|
193 |
|
|
194 |
/** |
|
195 |
* @deprecated for bidirectional use only |
|
196 |
*/ |
|
197 |
@Deprecated |
|
198 |
protected void addTypifiedName(TaxonNameBase taxonName){ |
|
199 |
this.typifiedNames.add(taxonName); |
|
200 |
} |
|
201 |
|
|
202 |
/** |
|
203 |
* @deprecated for bidirectional use only |
|
204 |
*/ |
|
205 |
@Deprecated |
|
206 |
protected void removeTypifiedName(TaxonNameBase taxonName){ |
|
207 |
this.typifiedNames.remove(taxonName); |
|
208 |
if (taxonName.getTypeDesignations().contains(this)){ |
|
209 |
taxonName.removeTypeDesignation(this); |
|
210 |
} |
|
211 |
} |
|
212 |
|
|
213 |
public abstract void removeType(); |
|
214 |
|
|
215 |
//*********************** CLONE ********************************************************/ |
|
216 |
|
|
217 |
/** |
|
218 |
* Clones <i>this</i> type designation. This is a shortcut that enables to create |
|
219 |
* a new instance that differs only slightly from <i>this</i> type designation by |
|
220 |
* modifying only some of the attributes.<BR> |
|
221 |
* CAUTION: the typifiedNames set is not cloned but empty after cloning as the typified |
|
222 |
* names is considered to be the not owning part of a bidirectional relationship. |
|
223 |
* This may be changed in future. |
|
224 |
* |
|
225 |
* @throws CloneNotSupportedException |
|
226 |
* |
|
227 |
* @see eu.etaxonomy.cdm.model.common.ReferencedEntityBase#clone() |
|
228 |
* @see java.lang.Object#clone() |
|
229 |
*/ |
|
230 |
@Override |
|
231 |
public Object clone() throws CloneNotSupportedException { |
|
232 |
TypeDesignationBase result = (TypeDesignationBase)super.clone(); |
|
233 |
|
|
234 |
result.typifiedNames = new HashSet<TaxonNameBase>(); |
|
235 |
// for (TaxonNameBase taxonNameBase : getTypifiedNames()){ |
|
236 |
// result.typifiedNames.add(taxonNameBase); |
|
237 |
// } |
|
238 |
|
|
239 |
|
|
240 |
//no changes to: notDesignated, typeStatus, homotypicalGroup |
|
241 |
return result; |
|
242 |
} |
|
243 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Reference.java | ||
---|---|---|
275 | 275 |
// @IndexedEmbedded |
276 | 276 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
277 | 277 |
// @InReference(groups=Level2.class) |
278 |
|
|
279 | 278 |
protected Reference<?> inReference; |
280 | 279 |
|
281 |
// @XmlElement(name = "FullReference") |
|
282 |
// @XmlIDREF |
|
283 |
// @XmlSchemaType(name = "IDREF") |
|
284 |
// @ManyToOne(fetch = FetchType.LAZY) |
|
285 |
//// @IndexedEmbedded |
|
286 |
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
287 |
// protected Reference fullReference; |
|
288 |
// |
|
289 |
// @XmlElement(name = "AbbreviatedReference") |
|
290 |
// @XmlIDREF |
|
291 |
// @XmlSchemaType(name = "IDREF") |
|
292 |
// @ManyToOne(fetch = FetchType.LAZY) |
|
293 |
//// @IndexedEmbedded |
|
294 |
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
295 |
// protected Reference abbreviatedReference; |
|
296 |
|
|
297 |
|
|
298 | 280 |
//********************************************************/ |
299 | 281 |
|
300 | 282 |
//The date range assigned to the reference. ISO Date range like. Flexible, year can be left out, etc |
... | ... | |
332 | 314 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
333 | 315 |
private TeamOrPersonBase<?> authorship; |
334 | 316 |
|
335 |
|
|
336 |
// @XmlElement(name = "ReferenceIdentity") |
|
337 |
// @XmlIDREF |
|
338 |
// @XmlSchemaType(name = "IDREF") |
|
339 |
// @ManyToOne(fetch = FetchType.LAZY) |
|
340 |
// //@IndexedEmbedded |
|
341 |
// @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
342 |
// @Transient |
|
343 |
// private ReferenceIdentity referenceIdentity; |
|
344 |
|
|
345 | 317 |
@XmlAttribute |
346 | 318 |
@Match(MatchMode.IGNORE) |
347 | 319 |
private int parsingProblem = 0; |
... | ... | |
450 | 422 |
this.editor = StringUtils.isBlank(editor)? null : editor; |
451 | 423 |
} |
452 | 424 |
|
453 |
// @Override |
|
454 |
// public String getSeries() { |
|
455 |
// return series; |
|
456 |
// } |
|
457 |
// |
|
458 |
// @Override |
|
459 |
// public void setSeries(String series) { |
|
460 |
// this.series = series; |
|
461 |
// } |
|
462 |
|
|
463 | 425 |
@Override |
464 | 426 |
public String getVolume() { |
465 | 427 |
return volume; |
... | ... | |
598 | 560 |
|
599 | 561 |
@Override |
600 | 562 |
public void setType(ReferenceType type) { |
601 |
this.setCacheStrategy(type.getCacheStrategy()); |
|
602 | 563 |
if (type == null){ |
603 | 564 |
this.type = ReferenceType.Generic; |
604 | 565 |
} else{ |
605 | 566 |
this.type = type; |
606 | 567 |
} |
568 |
this.setCacheStrategy(type.getCacheStrategy()); |
|
607 | 569 |
|
608 | 570 |
} |
609 | 571 |
|
... | ... | |
723 | 685 |
} |
724 | 686 |
|
725 | 687 |
|
726 |
|
|
727 |
|
|
728 | 688 |
/** |
729 | 689 |
* Returns "true" if the isNomenclaturallyRelevant flag is set. This |
730 | 690 |
* indicates that a {@link TaxonNameBase taxon name} has been originally |
... | ... | |
749 | 709 |
} |
750 | 710 |
|
751 | 711 |
|
752 |
// /** |
|
753 |
// * Returns the full reference that belongs to this abbreviated reference. If this |
|
754 |
// * reference is not abbreviated the full reference should be <code>null</code>.<BR> |
|
755 |
// * A full reference should be added to a reference |
|
756 |
// * which represents the abbreviated form of a reference. The full reference can be used |
|
757 |
// * by publication tools to link to the unabbreviated and therefore more complete version |
|
758 |
// * of the reference. |
|
759 |
// * |
|
760 |
// * @see #getAbbreviatedReference() |
|
761 |
// * @return the full reference |
|
762 |
// */ |
|
763 |
// public Reference getFullReference() { |
|
764 |
// return fullReference; |
|
765 |
// } |
|
766 |
// |
|
767 |
// /** |
|
768 |
// * @see #getFullReference() |
|
769 |
// * @param fullReference |
|
770 |
// */ |
|
771 |
// public void setFullReference(Reference fullReference) { |
|
772 |
// this.fullReference = fullReference; |
|
773 |
// } |
|
774 |
// |
|
775 |
// /** |
|
776 |
// * Returns the abbreviated reference that belongs to this full reference. If this |
|
777 |
// * reference is not a full reference the abbeviated referece must be <code>null</code>.<BR> |
|
778 |
// * An abbreviated reference should be added to a reference which represents the long (full) |
|
779 |
// * form of a reference. |
|
780 |
// * In future this may become a set or handled differently as there are multiple |
|
781 |
// * |
|
782 |
// * @see #getFullReference() |
|
783 |
// * @return the full reference |
|
784 |
// */ |
|
785 |
// public Reference getAbbreviatedReference() { |
|
786 |
// return abbreviatedReference; |
|
787 |
// } |
|
788 |
// |
|
789 |
// /** |
|
790 |
// * @see #getAbbreviatedReference() |
|
791 |
// * @param abbreviatedReference |
|
792 |
// * |
|
793 |
// */ |
|
794 |
// public void setAbbreviatedReference(Reference abbreviatedReference) { |
|
795 |
// this.abbreviatedReference = abbreviatedReference; |
|
796 |
// } |
|
797 |
|
|
798 | 712 |
//**************************************************** / |
799 | 713 |
|
800 |
// /** |
|
801 |
// * Returns the string representing the name of the editor of <i>this</i> |
|
802 |
// * generic reference. An editor is mostly a person (team) who assumed the |
|
803 |
// * responsibility for the content of the publication as a whole without |
|
804 |
// * being the author of this content.<BR> |
|
805 |
// * If there is an editor then the generic reference must be some |
|
806 |
// * kind of {@link PrintedUnitBase physical printed unit}. |
|
807 |
// * |
|
808 |
// * @return the string identifying the editor of <i>this</i> |
|
809 |
// * generic reference |
|
810 |
// * @see #getPublisher() |
|
811 |
// */ |
|
812 |
// protected String getEditor(){ |
|
813 |
// return this.editor; |
|
814 |
// } |
|
815 |
// |
|
816 |
// /** |
|
817 |
// * @see #getEditor() |
|
818 |
// */ |
|
819 |
// protected void setEditor(String editor){ |
|
820 |
// this.editor = editor; |
|
821 |
// } |
|
822 |
// |
|
823 |
// /** |
|
824 |
// * Returns the string representing the series (for instance for books or |
|
825 |
// * within journals) - and series part - in which <i>this</i> generic reference |
|
826 |
// * was published.<BR> |
|
827 |
// * If there is a series then the generic reference must be some |
|
828 |
// * kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}. |
|
829 |
// * |
|
830 |
// * @return the string identifying the series for <i>this</i> |
|
831 |
// * generic reference |
|
832 |
// */ |
|
833 |
// protected String getSeries(){ |
|
834 |
// return this.series; |
|
835 |
// } |
|
836 |
// |
|
837 |
// /** |
|
838 |
// * @see #getSeries() |
|
839 |
// */ |
|
840 |
// protected void setSeries(String series){ |
|
841 |
// this.series = series; |
|
842 |
// } |
|
843 |
// |
|
844 |
// /** |
|
845 |
// * Returns the string representing the volume (for instance for books or |
|
846 |
// * within journals) in which <i>this</i> generic reference was published.<BR> |
|
847 |
// * If there is a volume then the generic reference must be some |
|
848 |
// * kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}. |
|
849 |
// * |
|
850 |
// * @return the string identifying the volume for <i>this</i> |
|
851 |
// * generic reference |
|
852 |
// */ |
|
853 |
// protected String getVolume(){ |
|
854 |
// return this.volume; |
|
855 |
// } |
|
856 |
// |
|
857 |
// /** |
|
858 |
// * @see #getVolume() |
|
859 |
// */ |
|
860 |
// protected void setVolume(String volume){ |
|
861 |
// this.volume = volume; |
|
862 |
// } |
|
863 |
// |
|
864 |
// /** |
|
865 |
// * Returns the string representing the page(s) where the content of |
|
866 |
// * <i>this</i> generic reference is located.<BR> |
|
867 |
// * If there is a pages information then the generic reference must be some |
|
868 |
// * kind of {@link PrintedUnitBase physical printed unit} or an {@link Article article}. |
|
869 |
// * |
|
870 |
// * @return the string containing the pages corresponding to <i>this</i> |
|
871 |
// * generic reference |
|
872 |
// */ |
|
873 |
// protected String getPages(){ |
|
874 |
// return this.pages; |
|
875 |
// } |
|
876 |
// |
|
877 |
// /** |
|
878 |
// * @see #getPages() |
|
879 |
// */ |
|
880 |
// protected void setPages(String pages){ |
|
881 |
// this.pages = pages; |
|
882 |
// } |
|
883 |
|
|
884 | 714 |
|
885 | 715 |
/** |
886 | 716 |
* Returns a formatted string containing the entire reference citation, |
... | ... | |
1050 | 880 |
|
1051 | 881 |
|
1052 | 882 |
|
1053 |
// /** |
|
1054 |
// * Returns the reference identity object |
|
1055 |
// * @return the referenceIdentity |
|
1056 |
// */ |
|
1057 |
// public ReferenceIdentity getReferenceIdentity() { |
|
1058 |
// return referenceIdentity; |
|
1059 |
// } |
|
1060 |
// |
|
1061 |
// /** |
|
1062 |
// * For bidirectional use only |
|
1063 |
// * @param referenceIdentity the referenceIdentity to set |
|
1064 |
// */ |
|
1065 |
// protected void setReferenceIdentity(ReferenceIdentity referenceIdentity) { |
|
1066 |
// this.referenceIdentity = referenceIdentity; |
|
1067 |
// } |
|
1068 |
// |
|
1069 |
// /** |
|
1070 |
// * Returns the set of all identical references. Same as getReferenceIdentity().getReferences() |
|
1071 |
// * @return |
|
1072 |
// */ |
|
1073 |
// public Set<Reference> identicalReferences(){ |
|
1074 |
// return referenceIdentity.getReferences(); |
|
1075 |
// } |
|
1076 |
|
|
1077 |
|
|
1078 | 883 |
//********** Casting methods ***********************************/ |
1079 | 884 |
|
1080 | 885 |
/** |
... | ... | |
1235 | 1040 |
} |
1236 | 1041 |
|
1237 | 1042 |
|
1238 |
//public void setCacheStrategy(S cacheStrategy){ |
|
1239 |
// this.cacheStrategy = cacheStrategy; |
|
1240 |
//} |
|
1241 |
|
|
1242 | 1043 |
@Override |
1243 | 1044 |
public void setCacheStrategy(IReferenceBaseCacheStrategy iReferenceBaseCacheStrategy) { |
1244 | 1045 |
this.cacheStrategy = (S) iReferenceBaseCacheStrategy; |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/ReferenceIdentity.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
|
|
12 |
// NOT YET IN USE // |
|
13 |
package eu.etaxonomy.cdm.model.reference; |
|
14 |
|
|
15 |
import java.util.Set; |
|
16 |
|
|
17 |
import javax.persistence.FetchType; |
|
18 |
import javax.persistence.ManyToOne; |
|
19 |
import javax.persistence.OneToMany; |
|
20 |
import javax.xml.bind.annotation.XmlAccessType; |
|
21 |
import javax.xml.bind.annotation.XmlAccessorType; |
|
22 |
import javax.xml.bind.annotation.XmlElement; |
|
23 |
import javax.xml.bind.annotation.XmlElementWrapper; |
|
24 |
import javax.xml.bind.annotation.XmlIDREF; |
|
25 |
import javax.xml.bind.annotation.XmlSchemaType; |
|
26 |
import javax.xml.bind.annotation.XmlType; |
|
27 |
|
|
28 |
import org.apache.log4j.Logger; |
|
29 |
import org.hibernate.annotations.Cascade; |
|
30 |
import org.hibernate.annotations.CascadeType; |
|
31 |
import org.hibernate.envers.Audited; |
|
32 |
|
|
33 |
import eu.etaxonomy.cdm.model.common.VersionableEntity; |
|
34 |
|
|
35 |
/** |
|
36 |
* @author a.mueller |
|
37 |
* @created 30.06.2009 |
|
38 |
* @version 1.0 |
|
39 |
*/ |
|
40 |
@XmlAccessorType(XmlAccessType.FIELD) |
|
41 |
@XmlType(name = "ReferenceIdentity", propOrder = { |
|
42 |
"preferredLongForm", |
|
43 |
"preferredAbbreviation", |
|
44 |
"references" |
|
45 |
}) |
|
46 |
@Audited |
|
47 |
//@Entity |
|
48 |
public class ReferenceIdentity extends VersionableEntity { |
|
49 |
private static final long serialVersionUID = -6114973116800471106L; |
|
50 |
@SuppressWarnings("unused") |
|
51 |
private static final Logger logger = Logger.getLogger(ReferenceIdentity.class); |
|
52 |
|
|
53 |
@XmlElementWrapper(name = "References") |
|
54 |
@XmlElement(name = "Reference") |
|
55 |
@XmlIDREF |
|
56 |
@XmlSchemaType(name = "IDREF") |
|
57 |
@OneToMany(mappedBy="name", fetch= FetchType.LAZY) |
|
58 |
private Set<Reference> references; |
|
59 |
|
|
60 |
@XmlElement(name = "PreferredLongForm") |
|
61 |
@XmlIDREF |
|
62 |
@XmlSchemaType(name = "IDREF") |
|
63 |
@ManyToOne(fetch = FetchType.LAZY) |
|
64 |
//@IndexedEmbedded |
|
65 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
66 |
private Reference preferredLongForm; |
|
67 |
|
|
68 |
|
|
69 |
@XmlElement(name = "PreferredAbbreviation") |
|
70 |
@XmlIDREF |
|
71 |
@XmlSchemaType(name = "IDREF") |
|
72 |
@ManyToOne(fetch = FetchType.LAZY) |
|
73 |
//@IndexedEmbedded |
|
74 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
75 |
private Reference preferredAbbreviation; |
|
76 |
|
|
77 |
|
|
78 |
/** |
|
79 |
* @return the references |
|
80 |
*/ |
|
81 |
public Set<Reference> getReferences() { |
|
82 |
return references; |
|
83 |
} |
|
84 |
|
|
85 |
|
|
86 |
// /** |
|
87 |
// * Adds the reference to this reference identity |
|
88 |
// * @param reference |
|
89 |
// * @return |
|
90 |
// */ |
|
91 |
// public boolean addReference(Reference reference){ |
|
92 |
// if (reference == null){ |
|
93 |
// return false; |
|
94 |
// } |
|
95 |
// if (reference.getReferenceIdentity() != null){ |
|
96 |
// reference.setReferenceIdentity(this); |
|
97 |
// } |
|
98 |
// return this.references.add(reference); |
|
99 |
// } |
|
100 |
// |
|
101 |
// public boolean removeReference(Reference reference){ |
|
102 |
// if (reference == null){ |
|
103 |
// return false; |
|
104 |
// } |
|
105 |
// reference.setReferenceIdentity(null); |
|
106 |
// return this.references.remove(reference); |
|
107 |
// } |
|
108 |
|
|
109 |
|
|
110 |
/** |
|
111 |
* @return the preferredLongForm |
|
112 |
*/ |
|
113 |
public Reference getPreferredLongForm() { |
|
114 |
return preferredLongForm; |
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* @param preferredLongForm the preferredLongForm to set |
|
119 |
*/ |
|
120 |
public void setPreferredLongForm(Reference preferredLongForm) { |
|
121 |
this.preferredLongForm = preferredLongForm; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* @return the preferredAbbreviation |
|
126 |
*/ |
|
127 |
public Reference getPreferredAbbreviation() { |
|
128 |
return preferredAbbreviation; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* @param preferredAbbreviation the preferredAbbreviation to set |
|
133 |
*/ |
|
134 |
public void setPreferredAbbreviation(Reference preferredAbbreviation) { |
|
135 |
this.preferredAbbreviation = preferredAbbreviation; |
|
136 |
} |
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
} |
Also available in: Unified diff
minor