Project

General

Profile

Download (4.63 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.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
 * @version 1.0
38
 * @created 08-Nov-2007 13:06:39
39
 */
40
@XmlAccessorType(XmlAccessType.FIELD)
41
@XmlType(name = "NomenclaturalStatus", propOrder = {
42
    "ruleConsidered",
43
    "type"
44
})
45
@Entity
46
@Audited
47
public class NomenclaturalStatus extends ReferencedEntityBase implements Cloneable{
48
	private static final long serialVersionUID = -2451270405173131900L;
49
	static Logger logger = Logger.getLogger(NomenclaturalStatus.class);
50

    
51
	//The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in
52
	//the note property.
53
	@XmlElement(name = "RuleConsidered")
54
	private String ruleConsidered;
55

    
56
	@XmlElement(name = "NomenclaturalStatusType")
57
    @XmlIDREF
58
    @XmlSchemaType(name = "IDREF")
59
    @ManyToOne(fetch = FetchType.LAZY)
60
	private NomenclaturalStatusType type;
61

    
62
	/**
63
	 * Class constructor: creates a new empty nomenclatural status instance.
64
	 */
65
	protected NomenclaturalStatus() {
66
		super();
67
	}
68

    
69
	/**
70
	 * Creates a new nomenclatural status instance with a given
71
	 * {@link NomenclaturalStatusType nomenclatural status type}.
72
	 *
73
	 * @see #NomenclaturalStatus()
74
	 */
75
	public static NomenclaturalStatus NewInstance(NomenclaturalStatusType nomStatusType){
76
		return NewInstance(nomStatusType, null, null);
77
	}
78

    
79

    
80
	/**
81
	 * Creates a new nomenclatural status instance with a given
82
	 * {@link NomenclaturalStatusType nomenclatural status type}.
83
	 *
84
	 * @see #NomenclaturalStatus()
85
	 */
86
	public static NomenclaturalStatus NewInstance(NomenclaturalStatusType nomStatusType, Reference citation, String microCitation){
87
		NomenclaturalStatus status = new NomenclaturalStatus();
88
		status.setType(nomStatusType);
89
		status.setCitation(citation);
90
		status.setCitationMicroReference(microCitation);
91
		return status;
92
	}
93

    
94

    
95
	/**
96
	 * Returns the {@link NomenclaturalStatusType nomenclatural status type} of <i>this</i>
97
	 * nomenclatural status.
98
	 */
99
	public NomenclaturalStatusType getType(){
100
		return this.type;
101
	}
102

    
103
	/**
104
	 * @see  #getType()
105
	 */
106
	public void setType(NomenclaturalStatusType type){
107
		this.type = type;
108
	}
109

    
110
	/**
111
	 * Returns the nomenclatural code rule considered (that is the
112
	 * article/note/recommendation in the nomenclatural code ruling
113
	 * the {@link TaxonName#getNomenclaturalCode() taxon name(s)}) of <i>this</i>
114
	 * nomenclatural status. The considered rule gives the reason why the
115
	 * {@link NomenclaturalStatusType nomenclatural status type} has been
116
	 * assigned to the {@link TaxonName taxon name(s)}.
117
	 */
118
	public String getRuleConsidered(){
119
		return this.ruleConsidered;
120
	}
121

    
122
	/**
123
	 * @see  #getRuleConsidered()
124
	 */
125
	public void setRuleConsidered(String ruleConsidered){
126
		this.ruleConsidered = ruleConsidered;
127
	}
128

    
129

    
130
//*********************** CLONE ********************************************************/
131

    
132
	/**
133
	 * Clones <i>this</i> nomenclatural status. This is a shortcut that enables to create
134
	 * a new instance that differs only slightly from <i>this</i> nomenclatural status by
135
	 * modifying only some of the attributes.
136
	 *
137
	 * @see eu.etaxonomy.cdm.model.common.ReferencedEntityBase#clone()
138
	 * @see java.lang.Object#clone()
139
	 */
140
	@Override
141
	public Object clone() {
142
		try {
143
			NomenclaturalStatus result = (NomenclaturalStatus)super.clone();
144
			//no changes to: ruleConsidered, type
145
			return result;
146
		} catch (CloneNotSupportedException e) {
147
			logger.warn("Object does not implement cloneable");
148
			e.printStackTrace();
149
			return null;
150
		}
151
	}
152

    
153
}
(21-21/36)