1 |
9479da48
|
Andreas Müller
|
package eu.etaxonomy.cdm.model.common;
|
2 |
|
|
|
3 |
|
|
import javax.persistence.ManyToOne;
|
4 |
|
|
import javax.persistence.MappedSuperclass;
|
5 |
f28b5f66
|
a.babadshanjan
|
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 |
9479da48
|
Andreas Müller
|
|
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 |
f28b5f66
|
a.babadshanjan
|
@XmlAccessorType(XmlAccessType.FIELD)
|
20 |
|
|
@XmlType(name = "EventBase", propOrder = {
|
21 |
|
|
"timeperiod",
|
22 |
|
|
"actor",
|
23 |
|
|
"description"
|
24 |
|
|
})
|
25 |
b92a6173
|
a.babadshanjan
|
@XmlRootElement(name = "EventBase")
|
26 |
9479da48
|
Andreas Müller
|
@MappedSuperclass
|
27 |
|
|
public abstract class EventBase extends AnnotatableEntity implements IEvent {
|
28 |
0d575644
|
Andreas Müller
|
private static final long serialVersionUID = -1859035632758446593L;
|
29 |
|
|
@SuppressWarnings("unused")
|
30 |
|
|
private static final Logger logger = Logger.getLogger(EventBase.class);
|
31 |
9479da48
|
Andreas Müller
|
|
32 |
f28b5f66
|
a.babadshanjan
|
@XmlElement(name = "TimePeriod")
|
33 |
9479da48
|
Andreas Müller
|
private TimePeriod timeperiod = new TimePeriod();
|
34 |
f28b5f66
|
a.babadshanjan
|
|
35 |
|
|
@XmlElement(name = "Actor")
|
36 |
|
|
@XmlIDREF
|
37 |
|
|
@XmlSchemaType(name = "IDREF")
|
38 |
9479da48
|
Andreas Müller
|
private Agent actor;
|
39 |
f28b5f66
|
a.babadshanjan
|
|
40 |
|
|
@XmlElement(name = "Description")
|
41 |
9479da48
|
Andreas Müller
|
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 |
40bb0d48
|
Andreas Müller
|
|
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 |
6f881998
|
Andreas Müller
|
public Object clone() throws CloneNotSupportedException{
|
99 |
40bb0d48
|
Andreas Müller
|
EventBase result = (EventBase)super.clone();
|
100 |
|
|
//Actor
|
101 |
|
|
result.setActor(this.getActor());
|
102 |
|
|
//time period
|
103 |
bfb1ec0f
|
Andreas Müller
|
result.setTimeperiod((TimePeriod)this.getTimeperiod().clone());
|
104 |
40bb0d48
|
Andreas Müller
|
//no changes to: description
|
105 |
|
|
return result;
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
9479da48
|
Andreas Müller
|
}
|