2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.common
;
12 import javax
.persistence
.FetchType
;
13 import javax
.persistence
.ManyToOne
;
14 import javax
.persistence
.MappedSuperclass
;
15 import javax
.xml
.bind
.annotation
.XmlAccessType
;
16 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
17 import javax
.xml
.bind
.annotation
.XmlElement
;
18 import javax
.xml
.bind
.annotation
.XmlIDREF
;
19 import javax
.xml
.bind
.annotation
.XmlRootElement
;
20 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
21 import javax
.xml
.bind
.annotation
.XmlType
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.annotations
.Cascade
;
25 import org
.hibernate
.annotations
.CascadeType
;
26 import org
.hibernate
.envers
.Audited
;
27 import org
.hibernate
.search
.annotations
.Field
;
28 import org
.hibernate
.search
.annotations
.Index
;
29 import org
.hibernate
.search
.annotations
.IndexedEmbedded
;
31 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
33 @XmlAccessorType(XmlAccessType
.FIELD
)
34 @XmlType(name
= "EventBase", propOrder
= {
39 @XmlRootElement(name
= "EventBase")
42 public abstract class EventBase
extends AnnotatableEntity
implements IEvent
{
43 private static final long serialVersionUID
= -1859035632758446593L;
44 @SuppressWarnings("unused")
45 private static final Logger logger
= Logger
.getLogger(EventBase
.class);
47 @XmlElement(name
= "TimePeriod")
48 private TimePeriod timeperiod
= TimePeriod
.NewInstance();
50 @XmlElement(name
= "Actor")
52 @XmlSchemaType(name
= "IDREF")
53 @ManyToOne(fetch
= FetchType
.LAZY
)
55 @Cascade(CascadeType
.SAVE_UPDATE
)
56 private AgentBase
<?
> actor
;
58 @XmlElement(name
= "Description")
59 @Field(index
=Index
.YES
)
60 private String description
;
62 //******************** GETTER / SETTER *******************/
65 public TimePeriod
getTimeperiod() {
69 public void setTimeperiod(TimePeriod timeperiod
) {
70 if (timeperiod
== null){
71 timeperiod
= TimePeriod
.NewInstance();
73 this.timeperiod
= timeperiod
;
77 public AgentBase
getActor() {
81 public void setActor(AgentBase actor
) {
86 * The description of this event. Implementing classes may use this field for different purposes.
89 public String
getDescription() {
94 * @see #getDescription()
97 public void setDescription(String description
) {
98 this.description
= description
;
102 //*********** CLONE **********************************/
105 * Clones <i>this</i> event base. This is a shortcut that enables to
106 * create a new instance that differs only slightly from <i>this</i> event base
107 * by modifying only some of the attributes.<BR>
108 * This method overrides the clone method from {@link AnnotatableEntity AnnotatableEntity}.
110 * @see eu.etaxonomy.cdm.model.media.AnnotatableEntity#clone()
111 * @see java.lang.Object#clone()
114 public Object
clone() throws CloneNotSupportedException
{
115 EventBase result
= (EventBase
)super.clone();
116 //Actor //is this needed??
117 result
.setActor(this.getActor());
119 result
.setTimeperiod((TimePeriod
)this.getTimeperiod().clone());
120 //no changes to: description