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
|
|
13
|
import javax.persistence.Entity;
|
14
|
import javax.persistence.FetchType;
|
15
|
import javax.persistence.ManyToOne;
|
16
|
import javax.xml.bind.annotation.XmlAccessType;
|
17
|
import javax.xml.bind.annotation.XmlAccessorType;
|
18
|
import javax.xml.bind.annotation.XmlElement;
|
19
|
import javax.xml.bind.annotation.XmlIDREF;
|
20
|
import javax.xml.bind.annotation.XmlSchemaType;
|
21
|
import javax.xml.bind.annotation.XmlType;
|
22
|
|
23
|
import org.apache.log4j.Logger;
|
24
|
import org.hibernate.envers.Audited;
|
25
|
|
26
|
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
|
27
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
28
|
|
29
|
/**
|
30
|
* The class representing the assignation of a nomenclatural status to a
|
31
|
* {@link TaxonName taxon name}. This includes a {@link NomenclaturalStatusType nomenclatural status type}
|
32
|
* (for instance "invalid", "novum" or "conserved") and eventually the article
|
33
|
* of the corresponding {@link NomenclaturalCode nomenclatural code} this status assignation is based on.
|
34
|
* One nomenclatural status can be assigned to several taxon names.
|
35
|
*
|
36
|
* @author m.doering
|
37
|
* @since 08-Nov-2007 13:06:39
|
38
|
*/
|
39
|
@XmlAccessorType(XmlAccessType.FIELD)
|
40
|
@XmlType(name = "NomenclaturalStatus", propOrder = {
|
41
|
"ruleConsidered",
|
42
|
"type"
|
43
|
})
|
44
|
@Entity
|
45
|
@Audited
|
46
|
public class NomenclaturalStatus extends ReferencedEntityBase implements Cloneable{
|
47
|
private static final long serialVersionUID = -2451270405173131900L;
|
48
|
static Logger logger = Logger.getLogger(NomenclaturalStatus.class);
|
49
|
|
50
|
//The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in
|
51
|
//the note property.
|
52
|
@XmlElement(name = "RuleConsidered")
|
53
|
private String ruleConsidered;
|
54
|
|
55
|
@XmlElement(name = "NomenclaturalStatusType")
|
56
|
@XmlIDREF
|
57
|
@XmlSchemaType(name = "IDREF")
|
58
|
@ManyToOne(fetch = FetchType.LAZY)
|
59
|
private NomenclaturalStatusType type;
|
60
|
|
61
|
/**
|
62
|
* Class constructor: creates a new empty nomenclatural status instance.
|
63
|
*/
|
64
|
protected NomenclaturalStatus() {
|
65
|
super();
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* Creates a new nomenclatural status instance with a given
|
70
|
* {@link NomenclaturalStatusType nomenclatural status type}.
|
71
|
*
|
72
|
* @see #NomenclaturalStatus()
|
73
|
*/
|
74
|
public static NomenclaturalStatus NewInstance(NomenclaturalStatusType nomStatusType){
|
75
|
return NewInstance(nomStatusType, null, null);
|
76
|
}
|
77
|
|
78
|
|
79
|
/**
|
80
|
* Creates a new nomenclatural status instance with a given
|
81
|
* {@link NomenclaturalStatusType nomenclatural status type}.
|
82
|
*
|
83
|
* @see #NomenclaturalStatus()
|
84
|
*/
|
85
|
public static NomenclaturalStatus NewInstance(NomenclaturalStatusType nomStatusType, Reference citation, String microCitation){
|
86
|
NomenclaturalStatus status = new NomenclaturalStatus();
|
87
|
status.setType(nomStatusType);
|
88
|
status.setCitation(citation);
|
89
|
status.setCitationMicroReference(microCitation);
|
90
|
return status;
|
91
|
}
|
92
|
|
93
|
|
94
|
/**
|
95
|
* Returns the {@link NomenclaturalStatusType nomenclatural status type} of <i>this</i>
|
96
|
* nomenclatural status.
|
97
|
*/
|
98
|
public NomenclaturalStatusType getType(){
|
99
|
return this.type;
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* @see #getType()
|
104
|
*/
|
105
|
public void setType(NomenclaturalStatusType type){
|
106
|
this.type = type;
|
107
|
}
|
108
|
|
109
|
/**
|
110
|
* Returns the nomenclatural code rule considered (that is the
|
111
|
* article/note/recommendation in the nomenclatural code ruling
|
112
|
* the {@link TaxonName#getNomenclaturalCode() taxon name(s)}) of <i>this</i>
|
113
|
* nomenclatural status. The considered rule gives the reason why the
|
114
|
* {@link NomenclaturalStatusType nomenclatural status type} has been
|
115
|
* assigned to the {@link TaxonName taxon name(s)}.
|
116
|
*/
|
117
|
public String getRuleConsidered(){
|
118
|
return this.ruleConsidered;
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* @see #getRuleConsidered()
|
123
|
*/
|
124
|
public void setRuleConsidered(String ruleConsidered){
|
125
|
this.ruleConsidered = ruleConsidered;
|
126
|
}
|
127
|
|
128
|
|
129
|
//*********************** CLONE ********************************************************/
|
130
|
|
131
|
/**
|
132
|
* Clones <i>this</i> nomenclatural status. This is a shortcut that enables to create
|
133
|
* a new instance that differs only slightly from <i>this</i> nomenclatural status by
|
134
|
* modifying only some of the attributes.
|
135
|
*
|
136
|
* @see eu.etaxonomy.cdm.model.common.ReferencedEntityBase#clone()
|
137
|
* @see java.lang.Object#clone()
|
138
|
*/
|
139
|
@Override
|
140
|
public Object clone() {
|
141
|
try {
|
142
|
NomenclaturalStatus result = (NomenclaturalStatus)super.clone();
|
143
|
//no changes to: ruleConsidered, type
|
144
|
return result;
|
145
|
} catch (CloneNotSupportedException e) {
|
146
|
logger.warn("Object does not implement cloneable");
|
147
|
e.printStackTrace();
|
148
|
return null;
|
149
|
}
|
150
|
}
|
151
|
|
152
|
}
|