Project

General

Profile

Download (4.59 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 eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
14
import eu.etaxonomy.cdm.model.reference.Reference;
15

    
16
import org.apache.log4j.Logger;
17
import org.hibernate.envers.Audited;
18

    
19
import javax.persistence.*;
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.XmlIDREF;
24
import javax.xml.bind.annotation.XmlSchemaType;
25
import javax.xml.bind.annotation.XmlType;
26

    
27
/**
28
 * The class representing the assignation of a nomenclatural status to a 
29
 * {@link TaxonNameBase taxon name}. This includes a {@link NomenclaturalStatusType nomenclatural status type}
30
 * (for instance "invalid", "novum" or "conserved") and eventually the article
31
 * of the corresponding {@link NomenclaturalCode nomenclatural code} this status assignation is based on.
32
 * One nomenclatural status can be assigned to several taxon names.
33
 * 
34
 * @author m.doering
35
 * @version 1.0
36
 * @created 08-Nov-2007 13:06:39
37
 */
38
@XmlAccessorType(XmlAccessType.FIELD)
39
@XmlType(name = "NomenclaturalStatus", propOrder = {
40
    "ruleConsidered",
41
    "type"
42
})
43
@Entity
44
@Audited
45
public class NomenclaturalStatus extends ReferencedEntityBase implements Cloneable{
46
	private static final long serialVersionUID = -2451270405173131900L;
47
	static Logger logger = Logger.getLogger(NomenclaturalStatus.class);
48
	
49
	//The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in
50
	//the note property.
51
	@XmlElement(name = "RuleConsidered")
52
	private String ruleConsidered;
53
	
54
	@XmlElement(name = "NomenclaturalStatusType")
55
    @XmlIDREF
56
    @XmlSchemaType(name = "IDREF")
57
    @ManyToOne(fetch = FetchType.LAZY)
58
	private NomenclaturalStatusType type;
59

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

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

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

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

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

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

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

    
151
}
(14-14/28)