1
|
package eu.etaxonomy.cdm.model.common;
|
2
|
|
3
|
import javax.persistence.ManyToOne;
|
4
|
import javax.persistence.MappedSuperclass;
|
5
|
import javax.xml.bind.annotation.XmlAccessType;
|
6
|
import javax.xml.bind.annotation.XmlAccessorType;
|
7
|
import javax.xml.bind.annotation.XmlElement;
|
8
|
import javax.xml.bind.annotation.XmlIDREF;
|
9
|
import javax.xml.bind.annotation.XmlRootElement;
|
10
|
import javax.xml.bind.annotation.XmlSchemaType;
|
11
|
import javax.xml.bind.annotation.XmlType;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.hibernate.annotations.Cascade;
|
15
|
import org.hibernate.annotations.CascadeType;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.agent.Agent;
|
18
|
|
19
|
@XmlAccessorType(XmlAccessType.FIELD)
|
20
|
@XmlType(name = "EventBase", propOrder = {
|
21
|
"timeperiod",
|
22
|
"actor",
|
23
|
"description"
|
24
|
})
|
25
|
@XmlRootElement(name = "EventBase")
|
26
|
@MappedSuperclass
|
27
|
public abstract class EventBase extends AnnotatableEntity implements IEvent {
|
28
|
private static final long serialVersionUID = -1859035632758446593L;
|
29
|
@SuppressWarnings("unused")
|
30
|
private static final Logger logger = Logger.getLogger(EventBase.class);
|
31
|
|
32
|
@XmlElement(name = "TimePeriod")
|
33
|
private TimePeriod timeperiod = new TimePeriod();
|
34
|
|
35
|
@XmlElement(name = "Actor")
|
36
|
@XmlIDREF
|
37
|
@XmlSchemaType(name = "IDREF")
|
38
|
private Agent actor;
|
39
|
|
40
|
@XmlElement(name = "Description")
|
41
|
private String description;
|
42
|
|
43
|
|
44
|
/* (non-Javadoc)
|
45
|
* @see eu.etaxonomy.cdm.model.occurrence.IEvent#getTimeperiod()
|
46
|
*/
|
47
|
public TimePeriod getTimeperiod() {
|
48
|
return timeperiod;
|
49
|
}
|
50
|
/* (non-Javadoc)
|
51
|
* @see eu.etaxonomy.cdm.model.occurrence.IEvent#setTimeperiod(eu.etaxonomy.cdm.model.common.TimePeriod)
|
52
|
*/
|
53
|
public void setTimeperiod(TimePeriod timeperiod) {
|
54
|
this.timeperiod = timeperiod;
|
55
|
}
|
56
|
|
57
|
/* (non-Javadoc)
|
58
|
* @see eu.etaxonomy.cdm.model.occurrence.IEvent#getActor()
|
59
|
*/
|
60
|
@ManyToOne
|
61
|
@Cascade({CascadeType.SAVE_UPDATE})
|
62
|
public Agent getActor() {
|
63
|
return actor;
|
64
|
}
|
65
|
/* (non-Javadoc)
|
66
|
* @see eu.etaxonomy.cdm.model.occurrence.IEvent#setActor(eu.etaxonomy.cdm.model.agent.Agent)
|
67
|
*/
|
68
|
public void setActor(Agent actor) {
|
69
|
this.actor = actor;
|
70
|
}
|
71
|
|
72
|
/* (non-Javadoc)
|
73
|
* @see eu.etaxonomy.cdm.model.occurrence.IEvent#getDescription()
|
74
|
*/
|
75
|
public String getDescription() {
|
76
|
return description;
|
77
|
}
|
78
|
/* (non-Javadoc)
|
79
|
* @see eu.etaxonomy.cdm.model.occurrence.IEvent#setDescription(java.lang.String)
|
80
|
*/
|
81
|
public void setDescription(String description) {
|
82
|
this.description = description;
|
83
|
}
|
84
|
|
85
|
|
86
|
//*********** CLONE **********************************/
|
87
|
|
88
|
/**
|
89
|
* Clones <i>this</i> event base. This is a shortcut that enables to
|
90
|
* create a new instance that differs only slightly from <i>this</i> event base
|
91
|
* by modifying only some of the attributes.<BR>
|
92
|
* This method overrides the clone method from {@link AnnotatableEntity AnnotatableEntity}.
|
93
|
*
|
94
|
* @see eu.etaxonomy.cdm.model.media.AnnotatableEntity#clone()
|
95
|
* @see java.lang.Object#clone()
|
96
|
*/
|
97
|
@Override
|
98
|
public Object clone() throws CloneNotSupportedException{
|
99
|
EventBase result = (EventBase)super.clone();
|
100
|
//Actor
|
101
|
result.setActor(this.getActor());
|
102
|
//time period
|
103
|
result.setTimeperiod((TimePeriod)this.getTimeperiod().clone());
|
104
|
//no changes to: description
|
105
|
return result;
|
106
|
}
|
107
|
|
108
|
|
109
|
|
110
|
}
|